将jdk8升级到JDK11时,PowerMockito.mockStatic()上的org.powermock.api.mockito.ClassNotPreparedException

时间:2020-06-10 10:24:13

标签: powermockito openjdk-11 mockstatic

我在用SPOCK框架编写的单元测试代码中使用PowerMockito.mockStatic(LogServiceImpl)。即使我在课堂上宣布了@PrepareForTest([LogServiceImpl]),我也得到了org.powermock.api.mockito.ClassNotPreparedException

之前,它在JDK8中运行良好,但是当我升级到打开jdk 11时,会遇到此问题。

这是build.gradle文件中使用的powermock版本

   testCompile 'org.powermock:powermock-module-junit4-rule-agent:2.0.5'
   testCompile 'org.powermock:powermock-api-mockito2:2.0.5'

我尝试了

中给出的步骤

https://github.com/powermock/powermock/issues/933

https://github.com/powermock/powermock/issues/901

仍然无法解决。.请帮助我

0 个答案:

没有答案