Mockito: Wanted but not invoked

后端 未结 2 728
花落未央
花落未央 2021-02-13 18:43

I have a following test method:

MyClass myClass= Mockito.mock(MyClass.class);
Mockito.when(myClass.methodUsedInMethodBeingTested(Matchers.any(MyTypeParam.class))         


        
2条回答
  •  长发绾君心
    2021-02-13 19:43

    You are invoking the methodToTest on the mock instance. Because you have not configured it otherwise, that just returns null, it doesn't try to invoke any of the actual method's implementation.

提交回复
热议问题