Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.RealRequest


    public void testMatchWithRequestBodyWrongTypePattern() throws IOException {
       
        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


    public void testMatchWithRequestBodyWrongContent() throws IOException {
       
        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

    public void testMatchWithRequestBodyWrongContentPattern() throws IOException {
       
        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

    @Test
    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

    @Test
    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

    @Test
    public void testMatchWrongWithRequestHeaderString() throws Exception {
       
        headers.put("Cache-Control", "cache-please!");
       
        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(false));
    }
View Full Code Here

    @Test
    public void testMatchWrongWithMissingRequestHeaderString() throws Exception {
       
        headers.put("Another-Header", "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(false));
    }
View Full Code Here

    @Test
    public void testMatchWithRequestHeaderPattern() throws Exception {
       
        headers.put("Content-Length", "1234");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withHeader("Content-Length", Pattern.compile("\\d+"));
       
        assertThat(sut.isMatch(real, expected), is(true));
    }
View Full Code Here

    @Test
    public void testMatchWrongWithRequestHeaderPattern() throws Exception {
       
        headers.put("Content-Length", "invalid");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withHeader("Content-Length", Pattern.compile("\\d+"));
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

    }
   
    @Test
    public void testMatchWrongWithMissingRequestHeaderPattern() throws Exception {
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withHeader("Content-Length", Pattern.compile("\\d+"));
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

TOP

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

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.