Examples of asJson()


Examples of com.github.fge.jsonschema.core.report.ListProcessingReport.asJson()

            subReport = new ListProcessingReport(report.getLogLevel(),
                LogLevel.FATAL);
            ptr = schemaPointer.append(JsonPointer.of(keyword, index));
            newData = data.withSchema(tree.setPointer(ptr));
            processor.process(subReport, newData);
            fullReport.put(ptr.toString(), subReport.asJson());
            if (subReport.isSuccess())
                nrSuccess++;
        }

        if (nrSuccess != 1)
View Full Code Here

Examples of com.github.fge.jsonschema.report.ListProcessingReport.asJson()

        PROCESSOR.process(report, holder);
        final boolean success = report.isSuccess();

        ret.put(Response.VALID, success);
        ret.put(Response.RESULTS, report.asJson());
        return ret;
    }

    /*
     * We have to use that since Java is not smart enough to detect that
View Full Code Here

Examples of com.github.restdriver.serverdriver.http.response.DefaultResponse.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 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")));
    }
   
    @Test
    public void matchingNumbers() {
        String jsonContent = makeJson(" { 'thing' : 5 } ");
View Full Code Here

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

    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)));
    }
   
    @Test
    public void matchingNumbersAsLong() {
        String jsonContent = makeJson(" { 'thing' : 5 } ");
View Full Code Here

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

    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)));
    }
   
    @Test
    public void correctHandlingOfDouble_IntMismatch() {
        String jsonContent = makeJson(" { 'thing' : 5.00 } ");
View Full Code Here

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

    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!
    }
   
    @Test(expected = RuntimeJsonTypeMismatchException.class)
    public void matchingIntWhenNumberOverflows() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
View Full Code Here

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

    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)));
    }
   
    @Test(expected = RuntimeJsonTypeMismatchException.class)
    public void matchingDoubleWhenNumberOverflows() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
View Full Code Here

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

    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)));
    }
   
    @Test
    public void matchingLongWhenNumberOverflowsIsOK() {
        String jsonContent = makeJson(" { 'thing' : 4294967294 } ");
View Full Code Here

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

    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)));
    }
   
    @Test
    public void moreComplexJsonPathCanBeRunOverJsonResponse() throws ParseException {
        String jsonContent = makeJson(" { 'thing' : { 'sub' : { 'subsub' : 'valutron' } } } ");
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.