PowerMockito verify that a static method is never called
问题 I am writing a JUnit test to verify that a static method ( MyClass.myMethod() ) is never invoked in the method flow. I tried doing something like this: PowerMockito.verifyStatic(Mockito.never()); MyClass.myMethod(Mockito.any()); In doing so I receive an UnfinisedVerificationException. How do I test that MyClass.class has no interactions whatsoever in the method execution? 回答1: UnfinishedVerificationException will occur if the Class is not mocked yet but you are trying to verify the invocation