Class JsonAssertions

java.lang.Object
uk.org.webcompere.modelassert.json.JsonAssertions

public final class JsonAssertions extends Object
Jumping on point - create either an assertJson or a hamcrest. Facade/factory methods.
  • Constructor Details

    • JsonAssertions

      public JsonAssertions()
  • Method Details

    • assertJson

      public static AssertJson<String> assertJson(String json)
      Begin an assertJson 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 an assertJson style assertion
      Parameters:
      jsonNode - the already loaded JsonNode with the JSON to assert
      Returns:
      an AssertJson object for adding assertions to
    • assertJson

      public static AssertJson<File> assertJson(File file)
      Begin an assertJson style assertion
      Parameters:
      file - the file containing the json to assert
      Returns:
      an AssertJson object for adding assertions to
    • assertJson

      public static AssertJson<File> assertJson(Path path)
      Begin an assertJson style assertion
      Parameters:
      path - the path to the file containing the json to assert
      Returns:
      an AssertJson object for adding assertions to
    • assertJson

      public static AssertJson<Object> assertJson(Object object)
      Begin an assertJson style assertion
      Parameters:
      object - an object to convert to JSON to start with
      Returns:
      an AssertJson object for adding assertions to
    • json

      public static HamcrestJsonAssertionBuilder<String> json()
      Begin a hamcrest matcher based on a json String
      Returns:
      the matcher
    • jsonObject

      public static HamcrestJsonAssertionBuilder<Object> jsonObject()
      Begin a hamcrest matcher based on an object
      Returns:
      the matcher
    • jsonNode

      public static HamcrestJsonAssertionBuilder<com.fasterxml.jackson.databind.JsonNode> jsonNode()
      Begin a hamcrest matcher based on a json node
      Returns:
      the matcher
    • jsonFile

      public static HamcrestJsonAssertionBuilder<File> jsonFile()
      Begin a hamcrest matcher based on a json file
      Returns:
      the matcher
    • jsonFilePath

      public static HamcrestJsonAssertionBuilder<Path> jsonFilePath()
      Begin a hamcrest matcher based on a json file via Path
      Returns:
      the matcher
    • assertYaml

      public static AssertJson<String> assertYaml(String yaml)
      Begin an assertYaml style assertion
      Parameters:
      yaml - the String yaml to assert
      Returns:
      an AssertJson object for adding assertions to
    • assertYaml

      public static AssertJson<File> assertYaml(File file)
      Begin an assertYaml style assertion
      Parameters:
      file - the file containing the yaml to assert
      Returns:
      an AssertJson object for adding assertions to
    • assertYaml

      public static AssertJson<Path> assertYaml(Path path)
      Begin an assertYaml style assertion
      Parameters:
      path - the path to the file containing the yaml to assert
      Returns:
      an AssertJson object for adding assertions to
    • yaml

      public static HamcrestJsonAssertionBuilder<String> yaml()
      Begin a hamcrest matcher based on a yaml String
      Returns:
      the matcher
    • yamlFile

      public static HamcrestJsonAssertionBuilder<File> yamlFile()
      Begin a hamcrest matcher based on a yaml file
      Returns:
      the matcher
    • yamlFilePath

      public static HamcrestJsonAssertionBuilder<Path> yamlFilePath()
      Begin a hamcrest matcher based on a yaml file via Path
      Returns:
      the matcher