开发者

PowerMock MethodNotFoundException on verifyPrivate with method accepting Class

开发者 https://www.devze.com 2023-03-20 00:16 出处:网络
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..

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

精彩评论

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

关注公众号