我有一个想要测试的方法,如下所示:
//this is in a presenter that implements MyInterface
public void somemethodtotest(){
if(somecondition){
callsomeothermethod(this);
}
}
我有一个看起来像这样的测试。
@Test
public void testsomemethodtotest(){
Mock(myInterface.getClass());
when(somecondition).thenReturn(true);
Mockito.verify(mock).callsomeothermethod(myInterface);
}
我面临的问题是Powermockito认为我传递了错误的参数,即MyInterface,它由我的受测类实现。 它只是抛出“参数不同!想要的bla bla