Details
Recommendation type: Mockable invocations
Configurable in Preferences: Yes
Filter category: Mocking
Description
UTA displays this recommendation when it detects that a method that is not mocked has been called on a mock object. See Creating Mocks for details.
Example
public static class Example {
boolean performAction(IArg arg)
{
return arg.mockable();
}
}
public interface IArg {
boolean mockable();
}
@Test
public void testMockable()
{
IArg example = mock(IArg.class);
Example underTest = new Example();
underTest.performAction(example);
Click the Mock it link to extend the test with elements required for mock modification:
boolean mockableResult = false; // UTA: default value when(example.mockable()).thenReturn(mockableResult);