How to use PowerMock with Arquillian?

狂风中的少年 提交于 2019-12-23 12:35:07

问题


I tried to use PowerMockRule in a JUnit test that uses arquillian but I get java.lang.ExceptionInInitializerError Caused by: java.lang.IllegalStateException: PowerMockRule can only be used with the system classloader but was loaded by ModuleClassLoader for Module

I want to test something like this:

 @RunWith(Arquillian.class)
 @PrepareForTest(WARRRAworkffsTest.class)
 public class WARRRAworkffsTest  {

@Rule  
   public PowerMockRule rule = new PowerMockRule();  


   @Deployment(testable=true)
        public static EnterpriseArchive createDeployment() throws MalformedURLException {

// yadayada

return ear;


}


@Test
public void createTest(){
PowerMock usage
}

}

Can you help me to solve this? Or if you have another idea how should i do it, will be great.

来源:https://stackoverflow.com/questions/30799352/how-to-use-powermock-with-arquillian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!