Package com.github.tomakehurst.wiremock.http

Examples of com.github.tomakehurst.wiremock.http.ResponseDefinition.wasConfigured()


  @Test
  public void returnsNotConfiguredResponseForUnmappedRequest() {
    Request request = aRequest(context).withMethod(OPTIONS).withUrl("/not/mapped").build();
    ResponseDefinition response = mappings.serveFor(request);
    assertThat(response.getStatus(), is(HTTP_NOT_FOUND));
    assertThat(response.wasConfigured(), is(false));
  }
 
  @Test
  public void returnsMostRecentlyInsertedResponseIfTwoOrMoreMatch() {
    mappings.addMapping(new StubMapping(
View Full Code Here


    ResponseDefinition response =
      mappings.serveFor(
          aRequest(context, "1st get /scenario/resource")
          .withMethod(GET).withUrl("/scenario/resource").build());
   
    assertThat(response.wasConfigured(), is(false));
   
    mappings.resetScenarios();
    response =
      mappings.serveFor(
          aRequest(context, "2nd get /scenario/resource")
View Full Code Here

   
    @Test
    public void copyPreservesConfiguredFlag() {
        ResponseDefinition response = ResponseDefinition.notConfigured();
        ResponseDefinition copiedResponse = copyOf(response);
        assertFalse("Should be not configured", copiedResponse.wasConfigured());
    }

    private static final String STRING_BODY =
            "{                          \n" +
            "    \"status\": 200,            \n" +
View Full Code Here

   
    @Override
    public ResponseDefinition serveStubFor(Request request) {
        ResponseDefinition responseDefinition = stubMappings.serveFor(request);
        requestJournal.requestReceived(request);
        if (!responseDefinition.wasConfigured() && request.isBrowserProxyRequest() && browserProxyingEnabled) {
            return ResponseDefinition.browserProxy(request);
        }

        return responseDefinition;
    }
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.