I am trying to write Unit test cases using power mockito.
When using annotations @RunWith(PowerMockRunner.class)
I am getting the following compilation error:-
TypeMismatch: cannot convert from Class<PowerMockRunner> to Class<? extends Runner>
Here is the code snippet. Using junit 4.8.1 and power mock 1.6.2.
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
public class XXXTest {
@Test
public void testOne() {
if (true)
System.out.println("Success");
}
}
I downloaded and added Powermock-Module-Junit4 jar and did not add the dependent jar Powermock-Module-Junit4-Common.jar. When added common jar Powermock-Module-Junit4-Common resolved the error.
Thanks, Vasu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With