Package com.jayway.restassured.path.json

Examples of com.jayway.restassured.path.json.JsonPath


                body("links[0].method", equalTo("GET")).
                body("links[1].method", equalTo("GET")).
                body("links[2].method", equalTo("GET")).
                when().get("/api").asInputStream();

        JsonPath jsonPath = JsonPath.from(rootResponse);
        customersHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'customers'}").get("href");
        loansHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'loans'}").get("href");
        booksHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'books'}").get("href");
    }
View Full Code Here


                body("rows[1].name", equalTo("Kalle")).
                body("rows[1].links.size()", is(1)).
                statusCode(200).
                when().get(customersHref).asInputStream();

        JsonPath jsonPath = JsonPath.from(customersResponse);
        String customerHref = jsonPath.getString("rows[0].links[0].href");

        expect().
                body("name", equalTo("Mattias")).
                body("id", is(0)).
                body("links.size()", is(1)).
View Full Code Here

                body("rows[0].author", equalTo("J.R.R. Tolkien")).
                body("rows[0].links.size()", is(1)).
                statusCode(200).
                when().get(booksHref).asInputStream();

        JsonPath jsonPath = JsonPath.from(booksResponse);
        String bookHref = jsonPath.getString("rows[0].links[0].href");

        expect().
                body("title", equalTo("Lord of the Rings")).
                body("author", equalTo("J.R.R. Tolkien")).
                body("borrowed", is(false)).
View Full Code Here

                body("links[0].method", equalTo("GET")).
                body("links[1].method", equalTo("GET")).
                body("links[2].method", equalTo("GET")).
                when().get("/api").asInputStream();

        JsonPath jsonPath = JsonPath.from(rootResponse);
        customersHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'customers'}").get("href");
        loansHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'loans'}").get("href");
        booksHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'books'}").get("href");
        searchHref = jsonPath.<String, String>getMap("links.find {link -> link.rel == 'search'}").get("href");
    }
View Full Code Here

                body("rows[1].name", equalTo("Kalle")).
                body("rows[1].links.size()", is(3)).
                statusCode(200).
                when().get(customersHref).asString();

        JsonPath jsonPath = JsonPath.from(customersResponse);

        System.out.println(customersResponse);

        String customerHref = jsonPath.getString("rows[0].links[0].href");

        expect().
                body("name", equalTo("Mattias")).
                body("id", is(0)).
                body("links.size()", is(1)).
View Full Code Here

                body("rows[0].author", equalTo("J.R.R. Tolkien")).
                body("rows[0].links.size()", is(1)).
                statusCode(200).
                when().get(booksHref).asInputStream();

        JsonPath jsonPath = JsonPath.from(booksResponse);
        String bookHref = jsonPath.getString("rows[0].links[0].href");

        expect().
                body("title", equalTo("Lord of the Rings")).
                body("author", equalTo("J.R.R. Tolkien")).
                body("borrowed", is(false)).
View Full Code Here

        RestAssured.baseURI = jolokiaUrl;
        RestAssured.defaultParser = Parser.JSON;
        System.out.println("Checking URL: " + jolokiaUrl);

        // Need to do it that way since Jolokia doesnt return application/json as mimetype by default
        JsonPath json = with(get("/version").asString());
        json.prettyPrint();
        assertEquals(versionExpected, json.get("value.agent"));

        // Alternatively, set the mime type before, then Rest-assured's fluent API can be used
        given()
                .param("mimeType", "application/json")
                .get("/version")
View Full Code Here

        RestAssured.baseURI = jolokiaUrl;
        RestAssured.defaultParser = Parser.JSON;
        System.out.println("Checking URL: " + jolokiaUrl);

        // Need to do it that way since Jolokia doesnt return application/json as mimetype by default
        JsonPath json = with(get("/version").asString());
        json.prettyPrint();
        assertEquals(versionExpected, json.get("value.agent"));

        // Alternatively, set the mime type before, then Rest-assured's fluent API can be used
        given()
                .param("mimeType", "application/json")
                .get("/version")
View Full Code Here

    public static Object getSystemDefinedCodes(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {

        final String getResponse = given().spec(requestSpec).expect().spec(responseSpec).when()
                .get(CodeHelper.CODE_URL + "?" + Utils.TENANT_IDENTIFIER).asString();

        final JsonPath getResponseJsonPath = new JsonPath(getResponse);

        // get any systemDefined code
        return getResponseJsonPath.get("find { e -> e.systemDefined == true }");

    }
View Full Code Here

TOP

Related Classes of com.jayway.restassured.path.json.JsonPath

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.