0

I wish to verify a static call. Usually its not a problem, i just mock the class, call verifyStatic and call the static method.

mockStatic(MyStatic.class);
verifyStatic();
MyStatic.myMethod();

But the problem this time is I cant mock MyStatic because i still need to use some of the other methods there. Is it still possible to verify a static method call without mocking the whole class?

user1985273
  • 1,817
  • 15
  • 50
  • 85
  • Possible duplicate of [PowerMock, mock a static method, THEN call real methods on all other statics](http://stackoverflow.com/questions/14651138/powermock-mock-a-static-method-then-call-real-methods-on-all-other-statics) – Frank Mar 01 '16 at 14:45
  • Side note: usually this is a problem. Why? Well - you should avoid using PowerMock. If your design is to use static stuff all over the place; and then rely on PowerMock to get somehow tested ... suggestion: change your design; and avoid the need for PowerMock. – GhostCat Mar 01 '16 at 15:03

0 Answers0