PowerMock class not found

For some reason, I cannot run a fairly simple PowerMock example.

I have included powermock-mockito-1.5.1-fullin 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);

        // Compile error: PowerMock can't be resolved       
        PowerMock.replay(_cameraMock);
        // I also tried PowerMockito.replay(_cameraMock) but that also doesn't exist.

        camera.release();

        Mockito.verify(_cameraMock).release();
    }
}

As explained in the comment, a class PowerMockcannot 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.

+4
source share
2

, PowerMock.replay(_cameraMock);, EasyMock, , , Mockito.

+7

setUp() (Before), , , , , , "" .

( , ) , android.hardware.Camera Camera.release(), ? :

, , , . :

android.hardware.Camera mock = PowerMock.createMock(android.hardware.Camera.class);
PowerMock.expect(mock.release());
PowerMock.replay();

ICamera camera = new Camera(mock);
camera.release();
PowerMock.verify(mock);

camera.relase() android.hardware.Camera.release(), .

0

All Articles