I\'m running a junit
test case using the PowerMock
test runner.
I\'m using the following command line to execute it:
java -cp .:jun
This Exception occurs when you Import the legacy version of PowerMockRunner.class when using JUnit 4.X or higher version since this legacy class is not available to run when using it with @RunWith annotation. I have solved this issue by replacing older legacy version import with the new version.
Incorrect Import:
import org.powermock.modules.junit4.legacy.PowerMockRunner;
Correct Import:
import org.powermock.modules.junit4.PowerMockRunner;