Class BambooJsonUtils
- java.lang.Object
-
- com.atlassian.bamboo.testutils.json.BambooJsonUtils
-
public class BambooJsonUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 org.hamcrest.Matcher<org.codehaus.jackson.JsonNode>
containsAllElementsFrom(org.codehaus.jackson.JsonNode jsonNode)
static org.hamcrest.Matcher<org.codehaus.jackson.JsonNode>
containsAllElementsFrom(org.codehaus.jackson.JsonNode expected, Set<String> exceptions)
Creates a matcher that checks that all elements from the given JsonNode exist in the matched node.static @NotNull org.codehaus.jackson.JsonNode
getJsonResource(@NotNull String fileName, @NotNull Object object)
static @NotNull org.codehaus.jackson.JsonNode
getJsonResource(@NotNull String resourceName, @NotNull Object object, @NotNull Properties subs)
static @NotNull Function<io.restassured.path.json.JsonPath,Boolean>
jsonPathToBoolean(@NotNull String path)
static @NotNull Function<io.restassured.path.json.JsonPath,Integer>
jsonPathToInteger(@NotNull String path)
static <T> @NotNull Function<io.restassured.path.json.JsonPath,List<T>>
jsonPathToList(@NotNull String path, @NotNull Class<T> clazz)
static @NotNull Function<io.restassured.path.json.JsonPath,String>
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 Detail
-
getJsonResource
@NotNull public static @NotNull org.codehaus.jackson.JsonNode getJsonResource(@NotNull @NotNull String resourceName, @NotNull @NotNull Object object, @NotNull @NotNull Properties subs) throws IOException
- Throws:
IOException
-
getJsonResource
@NotNull public static @NotNull org.codehaus.jackson.JsonNode getJsonResource(@NotNull @NotNull String fileName, @NotNull @NotNull Object object) throws IOException
- Throws:
IOException
-
jsonPathToBoolean
@NotNull public static @NotNull Function<io.restassured.path.json.JsonPath,Boolean> jsonPathToBoolean(@NotNull @NotNull String path)
-
jsonPathToInteger
@NotNull public static @NotNull Function<io.restassured.path.json.JsonPath,Integer> jsonPathToInteger(@NotNull @NotNull String path)
-
jsonPathToList
@NotNull public static <T> @NotNull Function<io.restassured.path.json.JsonPath,List<T>> jsonPathToList(@NotNull @NotNull String path, @NotNull @NotNull Class<T> clazz)
-
jsonPathToString
@NotNull public static @NotNull Function<io.restassured.path.json.JsonPath,String> jsonPathToString(@NotNull @NotNull String path)
-
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<org.codehaus.jackson.JsonNode> containsAllElementsFrom(org.codehaus.jackson.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
public static org.hamcrest.Matcher<String> containsAllElementsFrom(String expectedStr)
-
containsAllElementsFrom
public static org.hamcrest.Matcher<org.codehaus.jackson.JsonNode> containsAllElementsFrom(org.codehaus.jackson.JsonNode jsonNode)
-
-