Class JsonAssertions
java.lang.Object
uk.org.webcompere.modelassert.json.JsonAssertions
Jumping on point - create either an assertJson or a hamcrest. Facade/factory methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AssertJson<com.fasterxml.jackson.databind.JsonNode>
assertJson
(com.fasterxml.jackson.databind.JsonNode jsonNode) Begin anassertJson
style assertionstatic AssertJson<File>
assertJson
(File file) Begin anassertJson
style assertionstatic AssertJson<Object>
assertJson
(Object object) Begin anassertJson
style assertionstatic AssertJson<String>
assertJson
(String json) Begin anassertJson
style assertionstatic AssertJson<File>
assertJson
(Path path) Begin anassertJson
style assertionstatic AssertJson<File>
assertYaml
(File file) Begin anassertYaml
style assertionstatic AssertJson<String>
assertYaml
(String yaml) Begin anassertYaml
style assertionstatic AssertJson<Path>
assertYaml
(Path path) Begin anassertYaml
style assertionstatic HamcrestJsonAssertionBuilder<String>
json()
Begin a hamcrest matcher based on a json Stringstatic HamcrestJsonAssertionBuilder<File>
jsonFile()
Begin a hamcrest matcher based on a json filestatic HamcrestJsonAssertionBuilder<Path>
Begin a hamcrest matcher based on a json file viaPath
static HamcrestJsonAssertionBuilder<com.fasterxml.jackson.databind.JsonNode>
jsonNode()
Begin a hamcrest matcher based on a json nodestatic HamcrestJsonAssertionBuilder<Object>
Begin a hamcrest matcher based on an objectstatic HamcrestJsonAssertionBuilder<String>
yaml()
Begin a hamcrest matcher based on a yaml Stringstatic HamcrestJsonAssertionBuilder<File>
yamlFile()
Begin a hamcrest matcher based on a yaml filestatic HamcrestJsonAssertionBuilder<Path>
Begin a hamcrest matcher based on a yaml file viaPath
-
Constructor Details
-
JsonAssertions
public JsonAssertions()
-
-
Method Details
-
assertJson
Begin anassertJson
style assertion- Parameters:
json
- the String json to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertJson
public static AssertJson<com.fasterxml.jackson.databind.JsonNode> assertJson(com.fasterxml.jackson.databind.JsonNode jsonNode) Begin anassertJson
style assertion- Parameters:
jsonNode
- the already loadedJsonNode
with the JSON to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertJson
Begin anassertJson
style assertion- Parameters:
file
- the file containing the json to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertJson
Begin anassertJson
style assertion- Parameters:
path
- the path to the file containing the json to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertJson
Begin anassertJson
style assertion- Parameters:
object
- an object to convert to JSON to start with- Returns:
- an
AssertJson
object for adding assertions to
-
json
Begin a hamcrest matcher based on a json String- Returns:
- the matcher
-
jsonObject
Begin a hamcrest matcher based on an object- Returns:
- the matcher
-
jsonNode
Begin a hamcrest matcher based on a json node- Returns:
- the matcher
-
jsonFile
Begin a hamcrest matcher based on a json file- Returns:
- the matcher
-
jsonFilePath
Begin a hamcrest matcher based on a json file viaPath
- Returns:
- the matcher
-
assertYaml
Begin anassertYaml
style assertion- Parameters:
yaml
- the String yaml to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertYaml
Begin anassertYaml
style assertion- Parameters:
file
- the file containing the yaml to assert- Returns:
- an
AssertJson
object for adding assertions to
-
assertYaml
Begin anassertYaml
style assertion- Parameters:
path
- the path to the file containing the yaml to assert- Returns:
- an
AssertJson
object for adding assertions to
-
yaml
Begin a hamcrest matcher based on a yaml String- Returns:
- the matcher
-
yamlFile
Begin a hamcrest matcher based on a yaml file- Returns:
- the matcher
-
yamlFilePath
Begin a hamcrest matcher based on a yaml file viaPath
- Returns:
- the matcher
-