PowerMock 抛出org.powermock.reflect.exceptions.MethodNotFoundException: No methods matching the name(s) methodInsideFoo were found in the class hierarchy of class com.something.Something.
。
测试代码:
Something spied = spy(new Something());
doNothing().when( spied, "methodInsideFoo", "ABC", Some.class );
spied.foo( "ABC", Some.class );
verifyPrivate( spied ).invoke( "methodInsideFoo", "ABC", Some.class );
这是我试图模拟的方法:
protected void methodInsideFoo ( String a, Class b )
{
System.out.println("Should not see me");
}
但是如果我删除类(第二个参数),它就可以工作。我错过了什么吗?