Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverResponse


        assertThat(response.getStatus(), is(200));
    }
   
    @Test
    public void creatingResponseWithEmptyStringContentGives200Status() {
        ClientDriverResponse response = new ClientDriverResponse("", "text/plain");
       
        assertThat(response.getStatus(), is(200));
    }
View Full Code Here


        assertThat(response.getStatus(), is(200));
    }
   
    @Test
    public void creatingResponseWithEmptyInputStreamGives200Status() {
        ClientDriverResponse response = new ClientDriverResponse(IOUtils.toInputStream(""), "application/octet-stream");
       
        assertThat(response.getStatus(), is(200));
    }
View Full Code Here

        assertThat(response.getStatus(), is(200));
    }
   
    @Test
    public void creatingResponseWithNullStringGives204Status() {
        ClientDriverResponse response = new ClientDriverResponse((String) null, "text/plain");
       
        assertThat(response.getStatus(), is(204));
    }
View Full Code Here

        assertThat(response.getStatus(), is(204));
    }
   
    @Test
    public void creatingResponseWithNullInputStreamGives204Status() {
        ClientDriverResponse response = new ClientDriverResponse((InputStream) null, "application/octet-stream");
       
        assertThat(response.getStatus(), is(204));
    }
View Full Code Here

    }
   
    @SuppressWarnings("deprecation")
    @Test
    public void creatingResponseWithStringContentHasTextContentType() {
        ClientDriverResponse response = new ClientDriverResponse("content");
       
        assertThat(response.getContentType(), is("text/plain"));
    }
View Full Code Here

        baseUrl = driver.getBaseUrl();
    }
   
    @Test
    public void simpleGetRetrievesStatusAndContent() {
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("Content", "text/plain"));
       
        Response response = get(baseUrl);
       
        assertThat(response, hasStatusCode(200));
        assertThat(response.getContent(), is("Content"));
View Full Code Here

   
    @SuppressWarnings("deprecation")
    @Test
    public void creatingEmptyResponseGivesNoContentType() {
       
        assertThat(new ClientDriverResponse().getContentType(), is(nullValue()));
        assertThat(new ClientDriverResponse((String) null).getContentType(), is(nullValue()));
        assertThat(new ClientDriverResponse("").getContentType(), is(nullValue()));
        assertThat(new ClientDriverResponse((InputStream) null, null).getContentType(), is(nullValue()));
        assertThat(new ClientDriverResponse(IOUtils.toInputStream(""), null).getContentType(), is(nullValue()));
       
    }
View Full Code Here

   
    @Test
    public void getRetrievesHeaders() {
        driver.addExpectation(
                new ClientDriverRequest("/"),
                new ClientDriverResponse("", null).withStatus(409).withHeader("X-foo", "barrr"));
       
        Response response = get(baseUrl);
       
        assertThat(response, hasStatusCode(409));
        assertThat(response, hasHeaderWithValue("X-foo", equalTo("barrr")));
View Full Code Here

        mockHttpRequest = mock(Request.class);
        mockHttpResponse = mock(HttpServletResponse.class);
        mockServletOutputStream = mock(ServletOutputStream.class);
        ServletInputStream servletInputStream = new DummyServletInputStream(IOUtils.toInputStream(""));
        realRequest = new ClientDriverRequest("/").withMethod(Method.GET);
        realResponse = new ClientDriverResponse("entity payload", "text/plain").withStatus(200).withHeader("Test", "header-should-be-set-before-writing-body");
       
        when(mockHttpRequest.getInputStream()).thenReturn(servletInputStream);
        when(mockHttpRequest.getMethod()).thenReturn("GET");
        when(mockHttpRequest.getReader()).thenReturn(new BufferedReader(new StringReader("")));
        when(mockRequestMatcher.isMatch((RealRequest) anyObject(), (ClientDriverRequest) anyObject())).thenReturn(true);
View Full Code Here

TOP

Related Classes of com.github.restdriver.clientdriver.ClientDriverResponse

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.