问题
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