Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.RealRequest


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


    @Test
    public void testMatchWithWrongParamPattern() {
       
        params = asMap("kk", "xx");
       
        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 testMatchWithNullParam() {
       
        params = asMap("kk", (String) null);
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("kk", "vv");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

    @Test
    public void testMatchWithParamsTooMany() {
       
        params = asMap("k1", "v1");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa")
                .withMethod(Method.GET)
                .withParam("kk", "vv")
                .withParam("k2", "v2");
        assertThat(sut.isMatch(real, expected), is(false));
View Full Code Here

    @Test
    public void testMatchWithParamsTooFew() {
       
        params = asMap("k1", "v1", "k2", "v2");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("kk", "vv");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

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

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

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

    @Test
    public void testFailedMatchWithMultipleIdenticalParamsInDifferentOrder() {
       
        params = asMap("key", asStringList("that", "this"));
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("key", "this").withParam("key", "tha");
       
        assertThat(sut.isMatch(real, expected), is(false));
    }
View Full Code Here

    @Test
    public void testFailedMatchWithWrongNumberOfIdenticalParams() {
       
        params = asMap("key", "that");
       
        RealRequest real = mockRealRequest("aaaaa", Method.GET, headers, params, content, contentType);
        ClientDriverRequest expected = new ClientDriverRequest("aaaaa").withMethod(Method.GET).withParam("key", "this").withParam("key", "that");
       
        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.