Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverResponse


        startLocalProxy();
       
        System.setProperty("http.proxyHost", "localhost");
        System.setProperty("http.proxyPort", "" + proxyPort);
       
        driver.addExpectation(new ClientDriverRequest("/foo"), new ClientDriverResponse("Content", "text/plain"));
       
        get(driver.getBaseUrl() + "/foo", usingSystemProxy());
        assertThat(proxyHits, is(1));
       
    }
View Full Code Here


        startLocalProxy();
       
        System.setProperty("http.proxyHost", "");
        System.setProperty("http.proxyPort", "");
       
        driver.addExpectation(new ClientDriverRequest("/foo"), new ClientDriverResponse("Content", "text/plain"));
       
        get(driver.getBaseUrl() + "/foo", usingSystemProxy());
        assertThat(proxyHits, is(0));
       
        stopLocalProxy();
View Full Code Here

    @Test
    public void simpleDeleteRetrievesStatusAndContent() {
       
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(ClientDriverRequest.Method.DELETE),
                new ClientDriverResponse("Content", "text/plain"));
       
        Response response = delete(baseUrl);
       
        assertThat(response, hasStatusCode(200));
        assertThat(response.getContent(), is("Content"));
View Full Code Here

   
    @Test
    public void deleteSendsHeaders() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(ClientDriverRequest.Method.DELETE).withHeader("Accept", "Nothing"),
                new ClientDriverResponse("Hello", "text/plain"));
       
        Response response = delete(baseUrl, header("Accept", "Nothing"));
        assertThat(response.getContent(), is("Hello"));
    }
View Full Code Here

   
    @Test
    public void deleteAllowsBodyContent() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(ClientDriverRequest.Method.DELETE).withBody("A BODY?", "text/plain"),
                new ClientDriverResponse("Hurrah", "text/plain").withStatus(418));
       
        Response response = delete(baseUrl, body("A BODY?", "text/plain"));
        assertThat(response.getStatusCode(), is(418));
    }
View Full Code Here

   
    @Test
    public void simpleHeadRetrievesStatus() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(Method.HEAD),
                new ClientDriverResponse());
       
        Response response = head(baseUrl);
       
        assertThat(response, hasStatusCode(204));
    }
View Full Code Here

   
    @Test
    public void headIgnoresEntity() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(Method.HEAD),
                new ClientDriverResponse("some content", "text/plain"));
       
        Response response = headOf(baseUrl);
       
        assertThat(response.getContent(), nullValue());
    }
View Full Code Here

    @Test
    public void getOnSameResourceAsHeadRequestRetrievesSameHeadersButWithAnEntity() {
       
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(Method.HEAD),
                new ClientDriverResponse("Content", "text/plain"));
        Response headResponse = doHeadOf(baseUrl);
       
        assertThat(headResponse, hasStatusCode(200));
       
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(Method.GET),
                new ClientDriverResponse("Content", "text/plain"));
        Response getResponse = get(baseUrl);
       
        assertThat(getResponse, hasStatusCode(200));
        assertThat(getResponse.getContent(), not(nullValue()));
       
View Full Code Here

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

   
    @Test
    public void headIncludesResponseTime() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(Method.HEAD),
                new ClientDriverResponse());
       
        Response response = head(baseUrl);
       
        assertThat(response.getResponseTime(), greaterThanOrEqualTo(0L));
    }
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.