Package org.mockserver.model

Examples of org.mockserver.model.HttpRequest


    }

    @Test
    public void shouldBuildObject() {
        // given
        HttpRequest httpRequest = new HttpRequest().withBody("some_body");
        HttpResponse httpResponse = new HttpResponse().withBody("some_response_body");
        HttpForward httpForward = new HttpForward().withHost("some_host");
        HttpCallback httpCallback = new HttpCallback().withCallbackClass("some_class");

        // when
View Full Code Here


    }

    @Test
    public void shouldReturnValueSetInSetter() {
        // given
        HttpRequestDTO httpRequest = new HttpRequestDTO(new HttpRequest().withBody("some_body"));
        TimesDTO times = new TimesDTO(Times.exactly(3));
        HttpResponseDTO httpResponse = new HttpResponseDTO(new HttpResponse().withBody("some_response_body"));
        HttpForwardDTO httpForward = new HttpForwardDTO(new HttpForward().withHost("some_host"));
        HttpCallbackDTO httpCallback = new HttpCallbackDTO(new HttpCallback().withCallbackClass("some_class"));
View Full Code Here

        List<HeaderDTO> headers = Arrays.asList(new HeaderDTO(new Header("name", "value")));
        String method = "METHOD";
        String path = "path";
        List<ParameterDTO> queryStringParameters = Arrays.asList(new ParameterDTO(new Parameter("name", "value")));
        String url = "url";
        HttpRequest httpRequest = new HttpRequest()
                .withBody("body")
                .withCookies(new Cookie("name", "value"))
                .withHeaders(new Header("name", "value"))
                .withMethod(method)
                .withPath(path)
View Full Code Here

        Header header = new Header("name", "value");
        String method = "METHOD";
        String path = "path";
        Parameter parameter = new Parameter("name", "value");
        String url = "url";
        HttpRequest httpRequest = new HttpRequest()
                .withBody(body)
                .withCookies(cookie)
                .withHeaders(header)
                .withMethod(method)
                .withPath(path)
                .withQueryStringParameter(parameter)
                .withURL(url);

        // when
        HttpRequest builtHttpRequest = new HttpRequestDTO(httpRequest).buildObject();

        // then
        assertThat(builtHttpRequest.getBody(), Is.<org.mockserver.model.Body>is(exact(body)));
        assertThat(builtHttpRequest.getCookies(), containsInAnyOrder(cookie));
        assertThat(builtHttpRequest.getHeaders(), containsInAnyOrder(header));
        assertThat(builtHttpRequest.getMethod(), is(method));
        assertThat(builtHttpRequest.getPath(), is(path));
        assertThat(builtHttpRequest.getQueryStringParameters(), containsInAnyOrder(parameter));
        assertThat(builtHttpRequest.getURL(), is(url));
    }
View Full Code Here

        List<HeaderDTO> headers = Arrays.asList(new HeaderDTO());
        String method = "METHOD";
        String path = "path";
        List<ParameterDTO> queryStringParameters = Arrays.asList(new ParameterDTO());
        String url = "url";
        HttpRequest httpRequest = new HttpRequest();

        // when
        HttpRequestDTO httpRequestDTO = new HttpRequestDTO(httpRequest);
        httpRequestDTO.setBody(body);
        httpRequestDTO.setCookies(cookies);
View Full Code Here

    }

    @Test
    public void shouldHandleNullFieldInput() {
        // when
        HttpRequestDTO httpRequestDTO = new HttpRequestDTO(new HttpRequest());

        // then
        assertThat(httpRequestDTO.getBody(), is(nullValue()));
        assertThat(httpRequestDTO.getCookies(), is(empty()));
        assertThat(httpRequestDTO.getHeaders(), is(empty()));
View Full Code Here

public class VerificationDTOTest {

    @Test
    public void shouldReturnValueSetInConstructor() {
        // given
        HttpRequest request = request();
        VerificationTimes times = VerificationTimes.atLeast(1);
        Verification verification = new Verification()
                .withRequest(request)
                .withTimes(times);
View Full Code Here

    }

    @Test
    public void shouldBuildObject() {
        // given
        HttpRequest request = request();
        VerificationTimes times = VerificationTimes.atLeast(1);
        Verification verification = new Verification()
                .withRequest(request)
                .withTimes(times);
View Full Code Here

        initMocks(this);

        // additional mock objects
        mockHttpServletRequest = new MockHttpServletRequest();
        mockHttpServletResponse = new MockHttpServletResponse();
        httpRequest = new HttpRequest().withPath("some_path");
        httpResponse = new HttpResponse();

        // mappers
        when(mockHttpServletToMockServerRequestMapper.mapHttpServletRequestToMockServerRequest(any(MockHttpServletRequest.class))).thenReturn(httpRequest);
        httpRequestArgumentCaptor = ArgumentCaptor.forClass(HttpRequest.class);
View Full Code Here

        // given
        // - add first filter
        ProxyRequestFilter filter = mock(ProxyRequestFilter.class);
        proxyServlet.withFilter(httpRequest, filter);
        // - add first filter with other request
        HttpRequest someOtherRequest = new HttpRequest().withPath("some_other_path");
        proxyServlet.withFilter(someOtherRequest, filter);
        // - add second filter
        ProxyRequestFilter someOtherFilter = mock(ProxyRequestFilter.class);
        proxyServlet.withFilter(someOtherRequest, someOtherFilter);
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.