📜  Mokito“具有以下具有不同参数的存根”-无论代码示例

📅  最后修改于: 2022-03-11 14:55:26.656000             🧑  作者: Mango

代码示例1
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)