use of org.powermock.core.classloader.annotations.PrepareEverythingForTest in project powermock by powermock.
the class ExpectNewDemoUsingThePrepareEverythingAnnotationTest method testGetMessage.
@PrepareEverythingForTest
@Test
public void testGetMessage() throws Exception {
ExpectNewDemo tested = new ExpectNewDemo();
MyClass myClassMock = createMock(MyClass.class);
expectNew(MyClass.class).andReturn(myClassMock);
String expected = "Hello altered World";
expect(myClassMock.getMessage()).andReturn("Hello altered World");
replayAll();
String actual = tested.getMessage();
verifyAll();
assertEquals("Expected and actual did not match", expected, actual);
}
Aggregations