Guest User

Untitled

a guest
Apr 12th, 2021
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public class TestMock {
  2. private static final String HOST = "localhost";
  3. private static final String END_POINT = "/footer";
  4. private static final int PORT = 1337;
  5. private static WireMockServer server = new WireMockServer(PORT);
  6.  
  7. @Test
  8. public void exampleTest() {
  9. server.start();
  10. WireMock.configureFor(HOST, 1337);
  11. ResponseDefinitionBuilder rdb = new ResponseDefinitionBuilder();
  12. rdb.withStatus(200);
  13. rdb.withBody("{\"message\" : \"hello world\"}");
  14. WireMock.stubFor(WireMock.get(END_POINT).willReturn(rdb));
  15. open("http://localhost:3000/");
  16.  
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment