Elad Benda2 Elad Benda2 -4 years ago 162
Java Question

cannot resolve symbol PowerMockRunner

I'm trying to use Powermock for the first time

I use build.gradle and added:

dependencies {
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.powermock:powermock-api-mockito:1.5.5'


now I look at my test class which has:

import org.junit.Before;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.powermock.core.classloader.annotations.PrepareForTest;


and get this error:

cannot resolve symbol PowerMockRunner

how come it resolves
and not

Answer Source

You need to import PowerMockRunner as follows:

import org.powermock.modules.junit4.PowerMockRunner;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download