Package com.github.tomakehurst.wiremock.testsupport

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.content()


                                "   <item>Buy milk</item>" +
                                "   <item>Cancel newspaper subscription</item>" +
                                "</items>")));

        WireMockResponse response = testClient.get("/todo/items");
        assertThat(response.content(), containsString("Buy milk"));
        assertThat(response.content(), not(containsString("Cancel newspaper subscription")));

        response = testClient.postWithBody("/todo/items", "Cancel newspaper subscription", "text/plain", "UTF-8");
        assertThat(response.statusCode(), is(201));
View Full Code Here


                                "   <item>Cancel newspaper subscription</item>" +
                                "</items>")));

        WireMockResponse response = testClient.get("/todo/items");
        assertThat(response.content(), containsString("Buy milk"));
        assertThat(response.content(), not(containsString("Cancel newspaper subscription")));

        response = testClient.postWithBody("/todo/items", "Cancel newspaper subscription", "text/plain", "UTF-8");
        assertThat(response.statusCode(), is(201));

        response = testClient.get("/todo/items");
View Full Code Here

        response = testClient.postWithBody("/todo/items", "Cancel newspaper subscription", "text/plain", "UTF-8");
        assertThat(response.statusCode(), is(201));

        response = testClient.get("/todo/items");
        assertThat(response.content(), containsString("Buy milk"));
        assertThat(response.content(), containsString("Cancel newspaper subscription"));
    }

    @Test
    public void delay() {
View Full Code Here

        response = testClient.postWithBody("/todo/items", "Cancel newspaper subscription", "text/plain", "UTF-8");
        assertThat(response.statusCode(), is(201));

        response = testClient.get("/todo/items");
        assertThat(response.content(), containsString("Buy milk"));
        assertThat(response.content(), containsString("Cancel newspaper subscription"));
    }

    @Test
    public void delay() {
        stubFor(get(urlEqualTo("/delayed")).willReturn(
View Full Code Here

        .inScenario("StateIndependent")
        .willSetStateTo("BodyModified"));
   
    WireMockResponse response = testClient.get("/state/independent/resource");
    assertThat(response.statusCode(), is(HTTP_OK));
    assertThat(response.content(), is("Some content"));
   
    testClient.put("/state/modifying/resource");
   
    response = testClient.get("/state/independent/resource");
    assertThat(response.statusCode(), is(HTTP_OK));
View Full Code Here

   
    testClient.put("/state/modifying/resource");
   
    response = testClient.get("/state/independent/resource");
    assertThat(response.statusCode(), is(HTTP_OK));
    assertThat(response.content(), is("Some content"));
  }
 
  @Test
  public void resetAllScenariosState() {
    givenThat(get(urlEqualTo("/stateful/resource"))
View Full Code Here

   
    testClient.addResponse(REGEX_URL_MAPPING_REQUEST);
    WireMockResponse response = testClient.get("/one/two/three");
   
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("Matched!"));
  }
}
View Full Code Here

    testClient.addResponse(MappingJsonSamples.BASIC_MAPPING_REQUEST_WITH_RESPONSE_HEADER);
   
    WireMockResponse response = testClient.get("/a/registered/resource");
   
    assertThat(response.statusCode(), is(401));
    assertThat(response.content(), is("Not allowed!"));
    assertThat(response.firstHeader("Content-Type"), is("text/plain"));
  }
 
  @Test
  public void mappingWithStatusOnlyResponseIsCreatedAndReturned() {
View Full Code Here

    testClient.addResponse(MappingJsonSamples.STATUS_ONLY_MAPPING_REQUEST);
   
    WireMockResponse response = testClient.put("/status/only");
   
    assertThat(response.statusCode(), is(204));
    assertNull(response.content());
  }
 
  @Test
  public void notFoundResponseIsReturnedForUnregisteredUrl() {
    WireMockResponse response = testClient.get("/non-existent/resource");
View Full Code Here

    @Test
    public void resetToDefaultRestoresOldMeaningOfDefault() {
        add200ResponseFor("/testmapping");
        WireMockResponse response1 = testClient.get("/testmapping");
        assertThat(response1.content(), is(""));

        testClient.resetDefaultMappings();

        WireMockResponse response2 = testClient.get("/testmapping");
        assertThat(response2.content(), is("default test mapping"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.