Package com.github.tomakehurst.wiremock.testsupport

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient


  @Before
  public void init() {
    wireMockServer = new WireMockServer();
    wireMockServer.start();
    WireMock.configure();
    testClient = new WireMockTestClient();
  }
View Full Code Here


 
      @Test
      public void canRegisterStubAndFetchOnCorrectPort() {
        givenThat(get(urlEqualTo("/rule/test")).willReturn(aResponse().withBody("Rule test body")));
       
        WireMockTestClient testClient = new WireMockTestClient(8089);
       
        assertThat(testClient.get("/rule/test").content(), is("Rule test body"));
      }
View Full Code Here

    }

    private static void assertCanRegisterStubAndFetchOnCorrectPort(WireMockClassRule wireMockRule) {
      wireMockRule.givenThat(get(urlEqualTo("/rule/test")).willReturn(aResponse().withBody("Rule test body")));

      WireMockTestClient testClient = new WireMockTestClient(wireMockRule.port());

      assertThat(testClient.get("/rule/test").content(), is("Rule test body"));
    }
View Full Code Here

        private void setupStubbing(Stubbing stubbing, String body) {
            stubbing.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withBody(body)));
        }

        private void stubIsCalledAndResponseIsCorrect(Stubbing stubbing, int port, String expectedText) {
            assertThat(new WireMockTestClient(port).get("/test").content(), is(expectedText));
            stubbing.verify(getRequestedFor(urlEqualTo("/test")));
        }
View Full Code Here

                    urls.add(request.getUrl());
                }
            });
            wireMockRule.stubFor(get(urlEqualTo("/test/listener")).willReturn(aResponse().withBody("Listener")));

            WireMockTestClient testClient = new WireMockTestClient(8089);
            assertThat(testClient.get("/test/listener").content(), is("Listener"));
            assertThat(urls.size(), is(1));
            assertThat(urls.get(0), is("/test/listener"));
        }
View Full Code Here

    WebAppContext context = new WebAppContext("sample-war/src/main/webappCustomMapping", "/wiremock");
    jetty.addHandler(context);
    jetty.start();
   
    WireMock.configureFor("localhost", 8085, "/wiremock/mapping");
    testClient = new WireMockTestClient(8085);
  }
View Full Code Here

TOP

Related Classes of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.