use of samples.newmocking.StupidNew in project powermock by powermock.
the class StupidNewTest method testGetMessageWithArgument.
@Test
public void testGetMessageWithArgument() throws Exception {
StupidNew tested = new StupidNew();
MyClass myClassMock = createMockAndExpectNew(MyClass.class);
String expected = "Hello altered World";
expect(myClassMock.getMessage("test")).andReturn("Hello altered World");
replay(myClassMock, MyClass.class);
String actual = tested.getMessageWithArgument();
verify(myClassMock, MyClass.class);
assertEquals("Expected and actual did not match", expected, actual);
}
use of samples.newmocking.StupidNew in project powermock by powermock.
the class StupidNewTest method testGetMessage.
@Test
public void testGetMessage() throws Exception {
StupidNew tested = new StupidNew();
MyClass myClassMock = createMockAndExpectNew(MyClass.class);
String expected = "Hello altered World";
expect(myClassMock.getMessage()).andReturn("Hello altered World");
replay(myClassMock, MyClass.class);
String actual = tested.getMessage();
verify(myClassMock, MyClass.class);
assertEquals("Expected and actual did not match", expected, actual);
}
use of samples.newmocking.StupidNew in project powermock by powermock.
the class StupidNewTest method testInvokeVoidMethod.
@Test
public void testInvokeVoidMethod() throws Exception {
StupidNew tested = new StupidNew();
MyClass myClassMock = createMockAndExpectNew(MyClass.class);
myClassMock.voidMethod();
expectLastCall().times(1);
replay(myClassMock, MyClass.class);
tested.invokeVoidMethod();
verify(myClassMock, MyClass.class);
}
Aggregations