开发者

PowerMock MethodNotFoundException on verifyPrivate with method accepting Class

PowerMock throws org.powermock.reflect.exceptions.MethodNotFoundException: No methods matching the name(s) methodInsideFoo were found in the class hierarchy of class com.something.Something..

Test code:

    Something spied = spy(new Something());

    doNothing().when( spied, "methodInsideFoo", "ABC", Some.class );

    spied.foo( "ABC", Some.class );

    verifyPrivate( spied ).invoke( "methodInsideFoo", "ABC", Some.class );

And this is the method I'm trying to mock:

protected void methodInsideFoo ( String a, Class b )
{
    System.out.println("Sh开发者_如何学运维ould not see me");
}

But if I remove Class (2nd parameter), it works. Am I missing something?


Could this be related to:

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

PowerMock, mockito, verify static method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜