📅  最后修改于: 2022-03-11 14:55:26.656000             🧑  作者: Mango
With strict stubs:
when(testClass.booleanMethod(anyBoolean())).thenAnswer(invocationOnMock -> {
if ((boolean) invocationOnMock.getArguments()[0]) {
return 1;
}
return 2;
});
--OR --
Using lenient mocking (not always a good idea)
@MockitoSettings(strictness = Strictness.LENIENT)