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:

https://github.com/jboss-javassist/javassist/pull/11


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -