Examples of ClientDriverRequest


Examples of com.github.restdriver.clientdriver.ClientDriverRequest

        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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

        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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    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
TOP
Copyright © 2018 www.massapi.com. 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.