Package com.github.restdriver.clientdriver

Examples of com.github.restdriver.clientdriver.ClientDriverRequest


    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


    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

    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

    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 simpleDeleteRetrievesStatusAndContent() {
       
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(ClientDriverRequest.Method.DELETE),
                new ClientDriverResponse("Content", "text/plain"));
       
        Response response = delete(baseUrl);
       
        assertThat(response, hasStatusCode(200));
View Full Code Here

    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 deleteSendsHeaders() {
        driver.addExpectation(
                new ClientDriverRequest("/").withMethod(ClientDriverRequest.Method.DELETE).withHeader("Accept", "Nothing"),
                new ClientDriverResponse("Hello", "text/plain"));
       
        Response response = delete(baseUrl, header("Accept", "Nothing"));
        assertThat(response.getContent(), is("Hello"));
    }
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.