For some reason, I cannot run a fairly simple PowerMock example.
I have included powermock-mockito-1.5.1-full
in my classpath, and I am trying to test a public final method (following this example ).
For some reason I cannot import into a class PowerMock
.
import org.junit.*;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.cleancode.lifesaver.camera.*;
@RunWith(PowerMockRunner.class)
@PrepareForTest(android.hardware.Camera.class)
public class CameraTests {
private android.hardware.Camera _cameraMock;
@Before
public void setUp() {
_cameraMock = PowerMockito.mock(android.hardware.Camera.class);
}
@Test
public void releaseCamera() {
ICamera camera = new Camera(_cameraMock);
PowerMock.replay(_cameraMock);
camera.release();
Mockito.verify(_cameraMock).release();
}
}
As explained in the comment, a class PowerMock
cannot be imported from a fake flag.
This seems like a silly question, but I really can't find anything on the Internet.
Where can I find a static class PowerMock
? I also used Java Decompile to search for the powermock library, without hits in powermock / replay.
source
share