eclipse 扩展 API 内部错误:org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37212371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Extension API internal error: org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl
提问by Thiago Gonzaga
I'm trying to write a unit test using PowerMockRunner but I got the following error:
我正在尝试使用 PowerMockRunner 编写单元测试,但出现以下错误:
java.lang.IllegalStateException: Extension API internal error: org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl could not be located in classpath. at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.getFrameworkReporterFactory(AbstractTestSuiteChunkerImpl.java:190) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.getMockingFrameworkReporter(JUnit4TestSuiteChunkerImpl.java:140) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:119) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53) at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
java.lang.IllegalStateException:扩展 API 内部错误:无法在类路径中找到 org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl。在 org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.getFrameworkReporterFactory(AbstractTestSuiteChunkerImpl.java:190) 在 org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.getMockingUnitChunkerImpl.getMockingUnitChunkerImpl.java:190 .modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:119) 在 org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:5powermockRunner.org:5 .modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59) 在 org.eclipse.jdt.internal.junit4.runner。
I've checked all the dependencies and it's ok, do I need somehthing else?
我已经检查了所有依赖项,没关系,我还需要其他东西吗?
回答by Thiago Gonzaga
After posting the question I found the answer, it seems to be a problem with version 1.6.5, it needs an additional dependency, it's described here.
发布问题后我找到了答案,似乎是 1.6.5 版本的问题,它需要额外的依赖项,在此处进行了描述。
The dependency is powermock-api-mockito-common version 1.6.5, you can either add it to you pom.xml
依赖是 powermock-api-mockito-common 版本 1.6.5,你可以将它添加到你的 pom.xml
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito-common</artifactId>
<version>1.6.5</version>
</dependency>
or download the jar
或者下载jar
回答by Moni
After adding
添加后
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito-common</artifactId>
<version>1.6.5</version>
</dependency>
we are getting - "java.lang.IllegalStateException: Extension API internal error: org.powermock.api.extension.proxyframework.ProxyFrameworkImpl could not be located in class path."
我们得到 - “java.lang.IllegalStateException:扩展 API 内部错误:无法在类路径中找到 org.powermock.api.extension.proxyframework.ProxyFrameworkImpl。”
To resolve this issue add below dependency as well -
要解决此问题,还要添加以下依赖项 -
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
now its working fine
现在它工作正常
回答by barath
Following these - http://fewtechissues.blogspot.com/2017/12/mockito-error.htmldependencies and versions fixed the issue for me.
按照这些 - http://fewtechissues.blogspot.com/2017/12/mockito-error.html依赖项和版本为我解决了这个问题。
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.7.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.0</version>
<scope>test</scope>
</dependency>