Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverRequest


    }
   
    @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 testMatchWrongPathPattern() {
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest(Pattern.compile("[b]{5}")).withMethod(Method.GET);
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

       
        content = "ooooh".getBytes();
        contentType = "text/junk";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody("ooooh", "text/junk");
       
        assertThat(sut.isMatch(real, expected), is(true));
    }
View Full Code Here

       
        content = "ooooh".getBytes();
        contentType = "text/junk";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody(Pattern.compile("[o]{4}h"), Pattern.compile("text/j[a-z]{3}"));
       
        assertThat(sut.isMatch(real, expected), is(true));
    }
View Full Code Here

       
        content = "ooooh".getBytes();
        contentType = "text/jnkular";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody("ooooh", "text/junk");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

       
        content = "ooooh".getBytes();
        contentType = "text/jnkular";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody("ooooh", Pattern.compile("text/[a-z]{4}"));
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

       
        content = "ooook".getBytes();
        contentType = "texy/junk";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody("ooooh", "text/junk");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

       
        content = "ooook".getBytes();
        contentType = "text/junk";
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withBody(Pattern.compile("[o]{4}h"), "text/junk");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

    public void testMatchWithRequestHeaderString() throws Exception {
       
        headers.put("Cache-Control", "no-cache");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withHeader("Cache-Control", "no-cache");
       
        assertThat(sut.isMatch(real, expected), is(true));
    }
View Full Code Here

    public void testMatchMultipleWithRequestHeaderString() throws Exception {
       
        headers.put("Some-Header", Collections.enumeration(Arrays.asList("foo", "bar")));
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withHeader("Some-Header", "bar");
       
        assertThat(sut.isMatch(real, expected), is(true));
    }
View Full Code Here

TOP

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

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.