-
Methods Method Description org.mockito.Mock.lenient() UseMock.strictness()
instead. Mock will be lenient, seeMockSettings.lenient()
. For examples how to use 'Mock' annotation and parameters seeMock
.org.mockito.mock.MockCreationSettings.isLenient() UseMockCreationSettings.getStrictness()
instead. Informs if the mock was created with "lenient" strictness, e.g. havingStrictness.LENIENT
characteristic. For more information about using mocks with lenient strictness, seeMockSettings.lenient()
.org.mockito.MockitoAnnotations.initMocks(Object) UseopenMocks(Object)
instead. This method is equivalent toopenMocks(testClass).close()
. The close method should however only be called after completed usage oftestClass
. If using static-mocks or customMockMaker
s, using this method might cause misbehavior of mocks injected into the test class.org.mockito.MockSettings.lenient() UseMockSettings.strictness(Strictness)
instead. Lenient mocks bypass "strict stubbing" validation (seeStrictness.STRICT_STUBS
). When mock is declared as lenient none of its stubbings will be checked for potential stubbing problems such as 'unnecessary stubbing' (UnnecessaryStubbingException
) or for 'stubbing argument mismatch'PotentialStubbingProblem
.
For more information and an elaborate example, seeFoo mock = mock(Foo.class, withSettings.lenient());
Mockito.lenient()
.
-
Annotation Type Elements Annotation Type Element Description org.mockito.Mock.lenient() UseMock.strictness()
instead. Mock will be lenient, seeMockSettings.lenient()
. For examples how to use 'Mock' annotation and parameters seeMock
.