Package org.mockserver.model

Examples of org.mockserver.model.HttpRequest


    }

    @Test
    public void shouldMapPUTRequest() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest().withMethod("PUT").withURL("http://localhost"), false);

        // then
        Assert.assertEquals(HttpPut.class, requestArgumentCaptor.getValue().getClass());
    }
View Full Code Here


    }

    @Test
    public void shouldMapTRACERequest() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest().withMethod("TRACE").withURL("http://localhost"), false);

        // then
        Assert.assertEquals(HttpTrace.class, requestArgumentCaptor.getValue().getClass());
    }
View Full Code Here

    }

    @Test
    public void shouldMapPATCHRequest() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest().withMethod("PATCH").withURL("http://localhost"), false);

        // then
        Assert.assertEquals(HttpPatch.class, requestArgumentCaptor.getValue().getClass());
    }
View Full Code Here

    }

    @Test
    public void shouldMapINCORRECTRequest() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest().withMethod("INCORRECT").withURL("http://localhost"), false);

        // then
        Assert.assertEquals(HttpGet.class, requestArgumentCaptor.getValue().getClass());
    }
View Full Code Here

        // given
        HttpResponse httpResponse = new HttpResponse().withStatusCode(200).withBody("exampleResponse");
        when(apacheHttpClientToMockServerResponseMapper.mapApacheHttpClientResponseToMockServerResponse(closeableHttpResponse, false)).thenReturn(httpResponse);

        // when
        HttpResponse httpResponseActual = apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("POST")
                        .withURL("http://host:8080/path")
                        .withPath("/path")
                        .withQueryStringParameters(
                                new Parameter("paramOneName", "paramOneValueOne", "paramOneValueTwo"),
View Full Code Here

        // given
        HttpResponse httpResponse = new HttpResponse().withStatusCode(200).withBody("exampleResponse");
        when(apacheHttpClientToMockServerResponseMapper.mapApacheHttpClientResponseToMockServerResponse(closeableHttpResponse, false)).thenReturn(httpResponse);

        // when
        HttpResponse httpResponseActual = apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("POST")
                        .withURL("http://host:8080/path"),
                false
        );
View Full Code Here

    }

    @Test
    public void shouldSendGETRequest() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("GET")
                        .withURL("http://host:8080/path")
                        .withPath("/path")
                        .withQueryStringParameters(
                                new Parameter("paramOneName", "paramOneValueOne", "paramOneValueTwo"),
View Full Code Here

    }

    @Test
    public void shouldRemoveTransferEncoding() throws Exception {
        // when
        apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("POST")
                        .withURL("http://host:8080/path")
                        .withHeaders(
                                new org.mockserver.model.Header(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING),
                                new org.mockserver.model.Header(HTTP.CONTENT_LEN, "0")
View Full Code Here

        HttpResponse httpResponse = new HttpResponse().withStatusCode(200).withBody("exampleResponse");
        when(apacheHttpClientToMockServerResponseMapper.mapApacheHttpClientResponseToMockServerResponse(closeableHttpResponse, false)).thenReturn(httpResponse);
        when(httpClient.execute(any(HttpUriRequest.class))).thenThrow(new IOException("TEST EXCEPTION", new CircularRedirectException("TEST EXCEPTION")));

        // then
        assertEquals(new HttpResponse(), apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("POST")
                        .withURL("http://host:8080/path")
                        .withHeaders(
                                new org.mockserver.model.Header(HTTP.CONTENT_LEN, "0")
                        )
View Full Code Here

    public void shouldHandleIOException() throws Exception {
        // given
        when(httpClient.execute(any(HttpUriRequest.class))).thenThrow(new IOException("TEST EXCEPTION"));

        // then
        apacheHttpClient.sendRequest(new HttpRequest()
                        .withMethod("POST")
                        .withURL("http://host:8080/path"),
                false
        );
    }
View Full Code Here

TOP

Related Classes of org.mockserver.model.HttpRequest

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.