0

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");
}

但是如果我删除类(第二个参数),它就可以工作。我错过了什么吗?

4

1 回答 1

0

这可能与:

http://code.google.com/p/powermock/issues/detail?id=342

PowerMock、mockito、验证静态方法

于 2012-01-20T23:53:32.217 回答