Power Mockito显示org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner的错误 [英] Power Mockito showing error for org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner cannot be resolved

查看:838
本文介绍了Power Mockito显示org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

模拟类中的静态方法.

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

When using PowerMockito in test class its showing error as

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

The type org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner cannot be resolved. It is indirectly referenced from required .class files

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

Added dependencies as below in gradle project.

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'

推荐答案

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'

这篇关于Power Mockito显示org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆