public class JsonHelper extends Object
| Constructor and Description |
|---|
JsonHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
configMapJsonKeyValues(io.restassured.response.Response response,
String keyValue)
map key value to config
eg.features.features.id:1:<$id>
|
static String |
getJsonValue(io.restassured.response.Response response,
String path)
gets json value as list if applicable, or string if single item converts to
string separted by ","
|
static String |
getResponseValue(io.restassured.response.Response response) |
static boolean |
isJSONValid(String test)
validates json string
|
static boolean |
isValidExpectation(String expectedJson) |
static String |
listToString(List<String> values) |
static void |
saveOutboundJsonParameters(io.restassured.response.Response response,
String outputParam)
replaces output parameter with response values eg.
|
static void |
validateByJsonBody(String expectedJson,
io.restassured.response.Response response)
validates expected json string against json body from response
|
static void |
validateByKeywords(String expectedJson,
io.restassured.response.Response response)
validates json response against hamcrest keywords
|
static void |
validateJsonKeywords(List<KeyValue> keywords,
io.restassured.response.Response response)
validates the json maps against the keyword requirements
examples: "person.roles.name": hasItems("admin"), "person.lastName":
equalTo("Administrator"), "person.lastName": isNotEmpty, "person.roles.name":
contains("admin"), "person.roles.name": containsInAnyOrder(admin),
"person.roles": nodeSizeGreaterThan(0), "person.sites.": nodeSizeExact(0)
"person.roles.name": sequence("admin"),
|
static void |
validateResponseBody(String expected,
io.restassured.response.Response response) |
public static void saveOutboundJsonParameters(io.restassured.response.Response response,
String outputParam)
response - outputParam - public static void configMapJsonKeyValues(io.restassured.response.Response response,
String keyValue)
response - keyValue - public static String getJsonValue(io.restassured.response.Response response, String path)
response - path - public static String getResponseValue(io.restassured.response.Response response)
public static void validateJsonKeywords(List<KeyValue> keywords, io.restassured.response.Response response)
jsonMap - response - public static boolean isJSONValid(String test)
test - public static void validateByJsonBody(String expectedJson, io.restassured.response.Response response)
expectedJson - actualJson - public static boolean isValidExpectation(String expectedJson)
public static void validateByKeywords(String expectedJson, io.restassured.response.Response response)
expectedJson - response - public static void validateResponseBody(String expected, io.restassured.response.Response response)
Copyright © 2019. All rights reserved.