Power Mockito showing error for org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner cannot be resolved

自古美人都是妖i 提交于 2019-12-13 00:52:46

问题


Mock the static method in class.

When using PowerMockito in test class its showing error as

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

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'

回答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'


来源:https://stackoverflow.com/questions/50063992/power-mockito-showing-error-for-org-powermock-modules-junit4-common-internal-imp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!