NoClassDefFoundError when using Powermock

前端 未结 5 1267
栀梦
栀梦 2020-12-09 01:24

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         


        
5条回答
  •  Happy的楠姐
    2020-12-09 02:22

    See here

    You're probably using the wrong PowerMockRunner. There's one runner made for JUnit 4.4 and above and a second runner made for JUnit 4.0-4.3 (although the latter also works for some older minor versions of JUnit 4.4).
    Try switching from the org.powermock.modules.junit4.PowerMockRunner to org.powermock.modules.junit4.legacy.PowerMockRunner or vice versa. Look at the getting started guide to see how to configure this in maven.

提交回复
热议问题