import org.junit.Test; import org.junit.runner.RunWith; import static org.easymock.EasyMock.expect; import static org.powermock.api.easymock.PowerMock.*; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.legacy.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest({Person.class }) public class PersonResourceTest { @Test public void testPost() { Person personMock = createMock(Person.class); expect(personMock.getName()).andReturn("Jon Smith"); replay(personMock); // do the test... Assert.assertEquals("Jon Smith", result.name); } }
4 classic reads, newly available on Google Books
12 hours ago
No comments:
Post a Comment