use of samples.privatefield.SimplePrivateFieldServiceClass in project powermock by powermock.
the class EasyMockAndPowerMockMixTest method testSimplePrivateFieldServiceClass.
@Test
public void testSimplePrivateFieldServiceClass() throws Exception {
SimplePrivateFieldServiceClass tested = new SimplePrivateFieldServiceClass();
Service serviceMock = createMock(Service.class);
setInternalState(tested, "service", serviceMock, SimplePrivateFieldServiceClass.class);
final String expected = "Hello world!";
expect(serviceMock.getServiceMessage()).andReturn(expected);
replay(serviceMock);
final String actual = tested.useService();
verify(serviceMock);
assertEquals(expected, actual);
}
use of samples.privatefield.SimplePrivateFieldServiceClass in project powermock by powermock.
the class SimplePrivateFieldServiceClassTest method testSimplePrivateFieldServiceClass.
@Test
public void testSimplePrivateFieldServiceClass() throws Exception {
SimplePrivateFieldServiceClass tested = new SimplePrivateFieldServiceClass();
Service serviceMock = createMock(Service.class);
setInternalState(tested, "service", serviceMock, SimplePrivateFieldServiceClass.class);
final String expected = "Hello world!";
expect(serviceMock.getServiceMessage()).andReturn(expected);
replay(serviceMock);
final String actual = tested.useService();
verify(serviceMock);
assertEquals(expected, actual);
}
use of samples.privatefield.SimplePrivateFieldServiceClass in project powermock by powermock.
the class SimplePrivateFieldServiceClassTest method testSimplePrivateFieldServiceClassTypeSafe.
@Test
public void testSimplePrivateFieldServiceClassTypeSafe() throws Exception {
SimplePrivateFieldServiceClass tested = new SimplePrivateFieldServiceClass();
Service serviceMock = createMock(Service.class);
setInternalState(tested, serviceMock);
final String expected = "Hello world!";
expect(serviceMock.getServiceMessage()).andReturn(expected);
replay(serviceMock);
final String actual = tested.useService();
verify(serviceMock);
assertEquals(expected, actual);
}
Aggregations