无法解析org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner的Power Mockito显示错误

时间:2018-04-27 13:57:49

标签: junit4 powermockito

在课堂上模拟静态方法。

在测试类中使用PowerMockito时,显示错误为

  

无法解析类型org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner。它是从所需的.class文件间接引用的

在gradle项目中添加了以下依赖项。

testCompile 'junit:junit:4.12'
testCompile 'org.easymock:easymock:3.1'
testCompile 'org.powermock:powermock-core:1.6.1'
testCompile 'org.powermock:powermock-module-junit4:1.6.1'
testCompile 'org.powermock:powermock-api-mockito:1.6.1'

1 个答案:

答案 0 :(得分:0)

Able to resolve the issue.


testCompile "org.springframework:spring-test:3.1.1.RELEASE"
    testCompile 'org.powermock:powermock-module-junit4-common:1.7.4'
    testCompile 'org.powermock:powermock-module-junit4:1.7.4'
    testCompile 'org.powermock:powermock-core:1.7.4'
    testCompile 'org.hamcrest:hamcrest-all:1.3'
    testCompile 'junit:junit:4.12'
    testCompile 'cglib:cglib-nodep:2.2'
    testCompile 'org.powermock:powermock-reflect:1.7.4'
    testCompile 'org.powermock:powermock-api-support:1.7.4'
    testCompile 'org.powermock:powermock-api-mockito:1.6.5'
    testCompile 'org.powermock:powermock-api-mockito2:1.7.0RC4'
    testCompile 'org.powermock:powermock-api-mockito-common:1.6.5'