java - Getting PowerMockito to mock a static method on an Interface? -
i have library trying mock testing... there java 8 interface static method implementation this:
public interface router { public static router router(object param) { return new routerimpl(param); } }
and trying mock returned value:
powermockito.mockstatic(router.class); powermockito.doreturn(mockrouter).when(router.router(any()));
but when run tests through debugger, mock instance not returned.
i've tried number of different permutations of static mocking, cannot static method return mock value. thoughts?
you doing right, have wait when mocking static interface method implemented/fixed in powermock. watch pull request: https://github.com/jayway/powermock/issues/510
note: news issue in javassist fixed:
Comments
Post a Comment