Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverResponse


       
    }
   
    @Test
    public void creatingResponseWithStringContentHasBody() {
        ClientDriverResponse response = new ClientDriverResponse("content", "text/plain");
       
        assertThat(response.hasBody(), is(true));
    }
View Full Code Here


   
    @Test
    public void getIncludesResponseTime() {
        driver.addExpectation(
                new ClientDriverRequest("/"),
                new ClientDriverResponse("Hello", "text/plain"));
       
        Response response = get(baseUrl);
       
        assertThat(response.getResponseTime(), greaterThanOrEqualTo(0L));
    }
View Full Code Here

   
    @Test
    public void getSendsHeaders() {
        driver.addExpectation(
                new ClientDriverRequest("/").withHeader("Accept", "Nothing"),
                new ClientDriverResponse("Hello", "text/plain"));
       
        Response response = get(baseUrl, header("Accept: Nothing"));
       
        assertThat(response.getResponseTime(), greaterThanOrEqualTo(0L));
    }
View Full Code Here

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

   
    @Test
    public void getDoesntFollowRedirects() {
        driver.addExpectation(
                new ClientDriverRequest("/"),
                new ClientDriverResponse("", "text/plain")
                        .withStatus(303)
                        .withHeader("Location", "http://foobar"));
       
        Response response = get(baseUrl);
       
View Full Code Here

    }
   
    @Test
    public void creatingEmptyResponseHasNoBody() {
       
        assertThat(new ClientDriverResponse().hasBody(), is(false));
        assertThat(new ClientDriverResponse((String) null, null).hasBody(), is(false));
        assertThat(new ClientDriverResponse("", null).hasBody(), is(false));
        assertThat(new ClientDriverResponse((InputStream) null, null).hasBody(), is(false));
        assertThat(new ClientDriverResponse(IOUtils.toInputStream(""), null).hasBody(), is(false));
       
    }
View Full Code Here

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

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

    }
   
    @Test
    public void creatingEmptyResponseHasEmptyStringContentWhenFetchingContentAsString() {
       
        assertThat(new ClientDriverResponse().getContent(), is(""));
        assertThat(new ClientDriverResponse((String) null, null).getContent(), is(""));
        assertThat(new ClientDriverResponse("", null).getContent(), is(""));
        assertThat(new ClientDriverResponse((InputStream) null, null).getContent(), is(""));
        assertThat(new ClientDriverResponse(IOUtils.toInputStream(""), null).getContent(), is(""));
       
    }
View Full Code Here

       
    }
   
    @Test
    public void creatingRepsonseWithStringReturnsCorrectByteArrayWhenFetchingContent() {
        ClientDriverResponse response = new ClientDriverResponse("some text", "text/plain");
       
        assertThat(response.getContentAsBytes(), is(("some text").getBytes()));
    }
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.