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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AssertJson<com.fasterxml.jackson.databind.JsonNode>assertJson(com.fasterxml.jackson.databind.JsonNode jsonNode) Begin anassertJsonstyle assertionstatic AssertJson<File>assertJson(File file) Begin anassertJsonstyle assertionstatic AssertJson<Object>assertJson(Object object) Begin anassertJsonstyle assertionstatic AssertJson<String>assertJson(String json) Begin anassertJsonstyle assertionstatic AssertJson<File>assertJson(Path path) Begin anassertJsonstyle assertionstatic AssertJson<File>assertYaml(File file) Begin anassertYamlstyle assertionstatic AssertJson<String>assertYaml(String yaml) Begin anassertYamlstyle assertionstatic AssertJson<Path>assertYaml(Path path) Begin anassertYamlstyle 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 viaPathstatic 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 anassertJsonstyle assertion- Parameters:
json- the String json to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertJson
public static AssertJson<com.fasterxml.jackson.databind.JsonNode> assertJson(com.fasterxml.jackson.databind.JsonNode jsonNode) Begin anassertJsonstyle assertion- Parameters:
jsonNode- the already loadedJsonNodewith the JSON to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertJson
Begin anassertJsonstyle assertion- Parameters:
file- the file containing the json to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertJson
Begin anassertJsonstyle assertion- Parameters:
path- the path to the file containing the json to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertJson
Begin anassertJsonstyle assertion- Parameters:
object- an object to convert to JSON to start with- Returns:
- an
AssertJsonobject 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 anassertYamlstyle assertion- Parameters:
yaml- the String yaml to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertYaml
Begin anassertYamlstyle assertion- Parameters:
file- the file containing the yaml to assert- Returns:
- an
AssertJsonobject for adding assertions to
-
assertYaml
Begin anassertYamlstyle assertion- Parameters:
path- the path to the file containing the yaml to assert- Returns:
- an
AssertJsonobject 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
-