Examples of ClientDriverRequest


Examples of com.github.restdriver.clientdriver.ClientDriverRequest

        baseUrl = driver.getBaseUrl();
    }
   
    @Test
    public void testToStringWithoutResponseBody() {
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("", null).withStatus(400));
       
        Response response = get(baseUrl);
       
        assertThat(response.toString(), containsString("HTTP/1.1 400 Bad Request"));
        assertThat(response.toString(), containsString("Content-Length: 0"));
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

       
    }
   
    @Test
    public void testToStringWithResponseBody() {
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("This is the content", "text/plain"));
       
        Response response = get(baseUrl);
       
        assertThat(response.toString(), containsString("HTTP/1.1 200 OK"));
        assertThat(response.toString(), containsString("Content-Type: text/plain"));
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    private String baseUrl;
   
    @Before
    public void getServerDetails() {
        baseUrl = driver.getBaseUrl();
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("NOT YET...", "text/plain"));
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("NOT YET...", "text/plain"));
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse("NOW!", "text/plain"));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test
    public void jsonPathCanBeRunOverJsonResponse() {
        String jsonContent = makeJson(" { 'thing' : 'valuoid' } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", equalTo("valuoid")));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test
    public void matchingNumbers() {
        String jsonContent = makeJson(" { 'thing' : 5 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", is(5)));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test
    public void matchingNumbersAsLong() {
        String jsonContent = makeJson(" { 'thing' : 5 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", is(5L)));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test
    public void correctHandlingOfDouble_IntMismatch() {
        String jsonContent = makeJson(" { 'thing' : 5.00 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), not(hasJsonPath("$.thing", is(5)))); // it's 5.0, not 5 dammit!
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test(expected = RuntimeJsonTypeMismatchException.class)
    public void matchingIntWhenNumberOverflows() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", greaterThan(5)));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test(expected = RuntimeJsonTypeMismatchException.class)
    public void matchingDoubleWhenNumberOverflows() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", greaterThan(5.1)));
    }
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest

    }
   
    @Test
    public void matchingLongWhenNumberOverflowsIsOK() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.thing", greaterThan(5L)));
    }
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.