Examples of asJson()


Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

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

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

                        "  { 'a': 'two', 'c' : 150 } ] } ");
       
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.things[?(@.c > 125)].a", hasItem(equalTo("two"))));
    }
   
    @Test
    public void jsonPathWithoutMatcher() {
        String jsonContent = makeJson("{'this':'thing','that':3}");
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

        String jsonContent = makeJson("{'this':'thing','that':3}");
       
        driver.addExpectation(new ClientDriverRequest("/"), new ClientDriverResponse(jsonContent, "application/json"));
        Response response = get(baseUrl);
       
        assertThat(response.asJson(), hasJsonPath("$.that"));
    }
   
    private String makeJson(String fakeJson) {
        return fakeJson.replace("'", "\"");
    }
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

        when(mockEntity.getContent()).thenReturn(IOUtils.toInputStream("This is not really json, is it?", "utf-8"));
        HttpResponse mockResponse = createMockResponse(mockEntity);
        Response response = new DefaultResponse(mockResponse, 12345);
       
        try {
            response.asJson();
            Assert.fail();
           
        } catch (RuntimeMappingException rme) {
            assertThat(rme.getMessage(), is("Can't parse JSON.  Bad content >> This is not real..."));
           
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

    public void getAcceptanceTestSeyrenConfig() {
        Response response = get(config());
        assertThat(response, hasStatusCode(200));
       
        // Base
        assertThat(response.asJson().size(), is(3));
        assertThat(response.asJson(), hasJsonPath("$.baseUrl", not(isEmptyOrNullString())));
        assertThat(response.asJson(), hasJsonPath("$.graphiteCarbonPickleEnabled", is(false)));
        assertThat(response.asJson(), hasJsonPath("$.graphsEnabled", is(true)));
    }
   
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

        Response response = get(config());
        assertThat(response, hasStatusCode(200));
       
        // Base
        assertThat(response.asJson().size(), is(3));
        assertThat(response.asJson(), hasJsonPath("$.baseUrl", not(isEmptyOrNullString())));
        assertThat(response.asJson(), hasJsonPath("$.graphiteCarbonPickleEnabled", is(false)));
        assertThat(response.asJson(), hasJsonPath("$.graphsEnabled", is(true)));
    }
   
}
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

        assertThat(response, hasStatusCode(200));
       
        // Base
        assertThat(response.asJson().size(), is(3));
        assertThat(response.asJson(), hasJsonPath("$.baseUrl", not(isEmptyOrNullString())));
        assertThat(response.asJson(), hasJsonPath("$.graphiteCarbonPickleEnabled", is(false)));
        assertThat(response.asJson(), hasJsonPath("$.graphsEnabled", is(true)));
    }
   
}
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

       
        // Base
        assertThat(response.asJson().size(), is(3));
        assertThat(response.asJson(), hasJsonPath("$.baseUrl", not(isEmptyOrNullString())));
        assertThat(response.asJson(), hasJsonPath("$.graphiteCarbonPickleEnabled", is(false)));
        assertThat(response.asJson(), hasJsonPath("$.graphsEnabled", is(true)));
    }
   
}
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

   
    @Test
    public void testGetAlertsReturnsOk() {
        Response response = get(alerts("1"));
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(0)));
        assertThat(response.asJson(), hasJsonPath("$.items", is(20)));
        assertThat(response.asJson(), hasJsonPath("$.start", is(0)));
        assertThat(response.asJson(), hasJsonPath("$.total", is(0)));
    }
   
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.Response.asJson()

    @Test
    public void testGetAlertsReturnsOk() {
        Response response = get(alerts("1"));
        assertThat(response, hasStatusCode(200));
        assertThat(response.asJson(), hasJsonPath("$.values", hasSize(0)));
        assertThat(response.asJson(), hasJsonPath("$.items", is(20)));
        assertThat(response.asJson(), hasJsonPath("$.start", is(0)));
        assertThat(response.asJson(), hasJsonPath("$.total", is(0)));
    }
   
    @Test
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.