Class TreeComparisonCondition

java.lang.Object
uk.org.webcompere.modelassert.json.condition.tree.TreeComparisonCondition
All Implemented Interfaces:
Condition

public class TreeComparisonCondition extends Object implements Condition
Compare with a whole JSON structure
  • Method Details

    • isEqualTo

      public static <T> TreeComparisonCondition isEqualTo(T json, JsonProvider<T> provider)
      Construct equals condition from any json object and its converter
      Type Parameters:
      T - the type of the JSON
      Parameters:
      json - the object to read the json from
      provider - the converter
      Returns:
      the condition
    • isEqualTo

      public static TreeComparisonCondition isEqualTo(com.fasterxml.jackson.databind.JsonNode tree)
      Construct equals condition from a JsonNode
      Parameters:
      tree - the json node
      Returns:
      the condition
    • withRules

      public TreeComparisonCondition withRules(List<PathRule> rules)
      Add rules to the comparison
      Parameters:
      rules - the rules
      Returns:
      this for fluent calling
    • test

      public Result test(com.fasterxml.jackson.databind.JsonNode json)
      Execute the test of the condition
      Specified by:
      test in interface Condition
      Parameters:
      json - the json to test
      Returns:
      a Result explaining whether the condition was met and if not, why not
    • describe

      public String describe()
      Describe the condition
      Specified by:
      describe in interface Condition
      Returns:
      description of the condition