java – 扩展API内部错误:org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl

前端之家收集整理的这篇文章主要介绍了java – 扩展API内部错误:org.powermock.api.extension.reporter.MockingFrameworkReporterFactoryImpl前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图用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)

我检查了所有的依赖项,没关系,我需要其他的东西吗?

解决方法

发布问题后,我找到了答案,这似乎是版本1.6.5的问题,它需要额外的依赖关系,它描述为 here.

依赖关系是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>

或下载jar

原文链接:https://www.f2er.com/java/122680.html

猜你在找的Java相关文章