org.mockito.exceptions.misusing.PotentialStubbingProblem: Strict stubbing argument mismatch 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)