Hey guys,
I'm trying to migrate PowerMock from 1.7.4 to 2.0.2 and Mockito from 1.10.19 to 2.25.0.
But the test using PowerMockito.verifyStatic now all get message like :
org.mockito.exceptions.misusing.NotAMockException:
Argument passed to verify() is of type Class and is not a mock!
I try to wright a very simple test code but it still get the same error
public class StaticClass {
public static void echo() {
System.out.println("echo");
}
}
public class NormalClass {
public void echo() {
StaticClass.echo();
}
}
// test file
@RunWith(PowerMockRunner.class)
@PrepareForTest({StaticClass.class})
public class NormalClassTest {
@Test
public void test() throws Exception {
PowerMockito.mockStatic(StaticClass.class);
new NormalClass().echo();
PowerMockito.verifyStatic(StaticClass.class);
}
}
Can somebody please tell me am I missing something in migration ?