Unit testing – use arquillian and powermock in the same JUnit test
•
Java
I want to use the functions of arquillian and powermock in the same JUnit 4 test
The problem is that both products are JUnit runners, which should be used together with @ runwith. It is impossible to use multiple @ runwith on the same test class or put multiple runners classes in the same @ runwith annotation
Do you know what to do
Solution
If you use powermock rule (this is testrule), you can use powermock instead of runner From powermockrule:
@RunWith(Arquillian.class); public class MyTest { @Rule PowerMockRule rule = new PowerMockRule(); // Tests goes here ... }
See also JUnit parameterized tests together with powermock – how? And the following threads in the powermock Google Group: using powermock without the runwith
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码