Package com.github.tomakehurst.wiremock.testsupport

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


        assertThat(encoding.get(), is("UTF-8"));
    }
 
  @Test
  public void fetchesFromRequest() {
    Request request = new MockRequestBuilder(context)
      .withHeader("Content-Type", "text/xml")
      .build();
   
    ContentTypeHeader contentTypeHeader = request.contentTypeHeader();
    assertThat(contentTypeHeader.mimeTypePart(), is("text/xml"));
View Full Code Here


    assertThat(contentTypeHeader.mimeTypePart(), is("text/xml"));
  }

  @Test(expected=NullPointerException.class)
  public void throwsExceptionOnAttemptToSetNullHeaderValue() {
    Request request = new MockRequestBuilder(context)
      .withHeader("Content-Type", null)
      .build();
 
        request.contentTypeHeader();
  }
View Full Code Here

              with(equalToJson(SAMPLE_REQUEST_MAPPING)));
      one(filesFileSource).writeBinaryFile(with(equal("body-recorded-content-1$2!3.json")),
                    with(equal("Recorded body content".getBytes(UTF_8))));
    }});
   
    Request request = new MockRequestBuilder(context)
      .withMethod(RequestMethod.GET)
      .withUrl("/recorded/content")
      .build();

        Response response = response()
View Full Code Here

            one(mappingsFileSource).writeTextFile(with(equal("mapping-headered-content-1$2!3.json")),
                    with(equalToJson(SAMPLE_REQUEST_MAPPING_WITH_HEADERS)));
            one(filesFileSource).writeBinaryFile("body-headered-content-1$2!3.json", "Recorded body content".getBytes(UTF_8));
        }});
       
        Request request = new MockRequestBuilder(context)
            .withMethod(RequestMethod.GET)
            .withUrl("/headered/content")
            .build();

        Response response = response()
View Full Code Here

            atLeast(1).of(admin).countRequestsMatching(with(any(RequestPattern.class))); will(returnValue(VerificationResult.withCount(2)));
            never(mappingsFileSource).writeTextFile(with(any(String.class)), with(any(String.class)));
            never(filesFileSource).writeTextFile(with(any(String.class)), with(any(String.class)));
        }});
     
      listener.requestReceived(new MockRequestBuilder(context)
                .withMethod(RequestMethod.GET)
                .withUrl("/headered/content")
                .build(),
            response().status(200).build());
  }
View Full Code Here

        Response response = response()
                .status(200)
                .fromProxy(false)
                .build();
     
        listener.requestReceived(new MockRequestBuilder(context)
                .withMethod(RequestMethod.GET)
                .withUrl("/headered/content")
                .build(),
            response);
  }
View Full Code Here

                    with(any(String.class)),
                    with(equalToJson(SAMPLE_REQUEST_MAPPING_WITH_BODY)));
            ignoring(filesFileSource);
        }});

        Request request = new MockRequestBuilder(context)
                .withMethod(POST)
                .withUrl("/body/content")
                .withHeader("Content-Type", "text/plain")
                .withBody("somebody")
                .build();
View Full Code Here

                    with(any(String.class)),
                    with(equalToJson(SAMPLE_REQUEST_MAPPING_WITH_REQUEST_HEADERS_2)));
            ignoring(filesFileSource);
        }});

        Request request1 = new MockRequestBuilder(context, "MockRequestAcceptHtml")
                .withMethod(GET)
                .withUrl("/same/url")
                .withHeader("Accept", "text/html")
                .build();
       
        Request request2 = new MockRequestBuilder(context, "MockRequestAcceptJson")
            .withMethod(GET)
            .withUrl("/same/url")
            .withHeader("Accept", "application/json")
            .build();
View Full Code Here

                    with(any(String.class)),
                    with(equalToJson(SAMPLE_REQUEST_MAPPING_WITH_JSON_BODY)));
            ignoring(filesFileSource);
        }});

        Request request = new MockRequestBuilder(context)
                .withMethod(POST)
                .withUrl("/json/content")
                .withHeader("Content-Type", "application/json ")
                .withBody("{}")
                .build();
View Full Code Here

                    with(any(String.class)),
                    with(equalToJson(SAMPLE_REQUEST_MAPPING_WITH_XML_BODY)));
            ignoring(filesFileSource);
        }});

        Request request = new MockRequestBuilder(context)
                .withMethod(POST)
                .withUrl("/xml/content")
                .withHeader("Content-Type", "text/xml; content-type=utf-8")
                .withBody("<stuff />")
                .build();
View Full Code Here

TOP

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

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.