Class BambooJsonUtils
java.lang.Object
com.atlassian.bamboo.testutils.json.BambooJsonUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode>
containsAllElementsFrom
(com.fasterxml.jackson.databind.JsonNode jsonNode) static org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode>
containsAllElementsFrom
(com.fasterxml.jackson.databind.JsonNode expected, Set<String> exceptions) Creates a matcher that checks that all elements from the given JsonNode exist in the matched node.static org.hamcrest.Matcher<String>
containsAllElementsFrom
(String expectedStr) static org.hamcrest.Matcher<String>
containsAllElementsFrom
(String expectedStr, Set<String> exceptions) Creates a matcher that checks that all elements from the given json string.static @NotNull com.fasterxml.jackson.databind.JsonNode
getJsonResource
(@NotNull String fileName, @NotNull Object object) static @NotNull com.fasterxml.jackson.databind.JsonNode
getJsonResource
(@NotNull String resourceName, @NotNull Object object, @NotNull Properties subs) jsonPathToBoolean
(@NotNull String path) jsonPathToInteger
(@NotNull String path) jsonPathToList
(@NotNull String path, @NotNull Class<T> clazz) jsonPathToString
(@NotNull String path) static @NotNull io.restassured.path.json.JsonPath
printableJsonPath
(@NotNull io.restassured.path.json.JsonPath jsonPath) Decorates aJsonPath
so that it will print the JSON content onObject.toString()
method call.
-
Method Details
-
getJsonResource
@NotNull public static @NotNull com.fasterxml.jackson.databind.JsonNode getJsonResource(@NotNull @NotNull String resourceName, @NotNull @NotNull Object object, @NotNull @NotNull Properties subs) throws IOException - Throws:
IOException
-
getJsonResource
@NotNull public static @NotNull com.fasterxml.jackson.databind.JsonNode getJsonResource(@NotNull @NotNull String fileName, @NotNull @NotNull Object object) throws IOException - Throws:
IOException
-
jsonPathToBoolean
-
jsonPathToInteger
-
jsonPathToList
-
jsonPathToString
-
printableJsonPath
@NotNull public static @NotNull io.restassured.path.json.JsonPath printableJsonPath(@NotNull @NotNull io.restassured.path.json.JsonPath jsonPath) Decorates aJsonPath
so that it will print the JSON content onObject.toString()
method call. -
containsAllElementsFrom
public static org.hamcrest.Matcher<String> containsAllElementsFrom(String expectedStr, Set<String> exceptions) Creates a matcher that checks that all elements from the given json string. exist in the matched node. Note that this does not recurse nodes.- Parameters:
expectedStr
- The items expected in the real nodes.exceptions
- Set of strings for attributes that should be ignored when performing the comparison- Returns:
- a Matcher that checks that all the expected nodes exist.
-
containsAllElementsFrom
public static org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode> containsAllElementsFrom(com.fasterxml.jackson.databind.JsonNode expected, Set<String> exceptions) Creates a matcher that checks that all elements from the given JsonNode exist in the matched node. Note that this recurses nodes in objects to check for equality. Arrays must be exact and in-order.- Parameters:
expected
- The items expected in the real nodes.exceptions
- Set of strings for attributes that should be ignored when performing the comparison- Returns:
- a Matcher that checks that all the expected nodes exist.
-
containsAllElementsFrom
-
containsAllElementsFrom
public static org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode> containsAllElementsFrom(com.fasterxml.jackson.databind.JsonNode jsonNode)
-