Answers for "Strict stubbing argument mismatch"

1

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)
Posted by: Guest on January-04-2021

Browse Popular Code Answers by Language