Closed picimako closed 1 year ago
The javadoc of some methods in org.mockito.MockSettings states that they have simpler versions of creating and configuring the mock:
org.mockito.MockSettings
spiedInstance
Foo foo = spy(fooInstance); //does exactly the same as: Foo foo = mock(Foo.class, withSettings().spiedInstance(fooInstance));
name
Foo foo = mock(Foo.class, "foo"); //does exactly the same as: Foo foo = mock(Foo.class, withSettings().name("foo"));
defaultAnswer
Foo mockTwo = mock(Foo.class, new YourOwnAnswer()); //does exactly the same as: Foo mockTwo = mock(Foo.class, withSettings().defaultAnswer(new YourOwnAnswer()));
withSettings()
Completed in v0.11.0.
Summary
The javadoc of some methods in
org.mockito.MockSettings
states that they have simpler versions of creating and configuring the mock:spiedInstance
name
defaultAnswer
Tasks
withSettings()
based mock creation.