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

しかし、クラス (2 番目のパラメーター) を削除すると、機能します。何か不足していますか?

4

1 に答える 1

0

これは次のことに関連している可能性があります。

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

PowerMock、mockito、静的メソッドの検証

于 2012-01-20T23:53:32.217 に答える