Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.RealRequest


    @Test
    public void testFailedMatchWithOneWrongParamPattern() {
       
        params = asMap("kk", asStringList("v1", "v2"));
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("kk", Pattern.compile("[v]{2}"));
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here


    }
   
    @Test
    public void testSuccessfulMatchAnyParamsWithNone() {
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withAnyParams();
       
        assertThat(sut.isMatch(real, expected), is(true));
       
    }
View Full Code Here

    @Test
    public void testSuccessfulMatchAnyParamsWithOne() {
       
        params = asMap("kk", asStringList("v1", "v2"));
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withAnyParams();
       
        assertThat(sut.isMatch(real, expected), is(true));
       
    }
View Full Code Here

    @Test
    public void testSuccessfulMatchAnyParamsWithRedundantExpectedParameter() {
       
        params = asMap("kk", asStringList("v1", "v2"));
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("mm", "x").withAnyParams();
       
        assertThat(sut.isMatch(real, expected), is(true));
       
    }
View Full Code Here

    }
   
    @Test
    public void testMatchWrongMethod() {
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.DELETE);
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

    }
   
    @Test
    public void testMatchWrongPath() {
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("bbbbb").withMethod(Method.GET);
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
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

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

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

    public void testMatchWithRequestBodyWrongType() 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", "text/junk");
       
        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.