I\'ve been trying to figure out how to run parameterized tests in Junit4 together with PowerMock. The problem is that to use PowerMock you need to decorate your test class w
I had the same issue. Unfortunately it would not let me use a PowerMock Rule due to the JVM I had. Instead of the rule I used RunnerDelegate.
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(Parameterized.class)
You can't use two class runners at once, so you will definitely have to write your own test runner to make that happen.
I don't know anything about Powermock, but after 10 seconds of research, it looks like one solution would be to write a test runner which uses powermock's class loader and runs parameterized tests. If you can figure out how to delegate to the parameterized test runner from within your custom test runner, that might be your best bet.
The following solution worked for me!
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(Parameterized.class)
Yes this works by using the PowerMock Rule available if you use JUnit 4.7+.