Java – unable to resolve symbols for powermockrunner
•
Java
I tried powermock for the first time
I use build Gradle and add:
dependencies {
...
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.powermock:powermock-api-mockito:1.5.5'
}
Now let me look at my test class. It has:
import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.Matchers; import org.powermock.core.classloader.annotations.PrepareForTest; @RunWith(PowerMockRunner.class) @PrepareForTest(GeoUtils.class)
And get this error:
@RunWith(PowerMockRunner.class)
^
cannot resolve symbol PowerMockRunner
How to solve preparefortest instead of powermockrunner?
Solution
You need to import powermockrunner as follows:
import org.powermock.modules.junit4.PowerMockRunner;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
