Strict stubbing argument mismatch. Please check: code example
Example: Mokito "has following stubbing(s) with different arguments"
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)