Class ObjectContainsKeys

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

public class ObjectContainsKeys extends Object implements Condition
An object node contains given keys/field
  • Constructor Details

    • ObjectContainsKeys

      public ObjectContainsKeys(String key, String... keys)
      Construct with the keys to find - a varargs with a minimum of 1 argument
      Parameters:
      key - the first key
      keys - additional keys
    • ObjectContainsKeys

      public ObjectContainsKeys(boolean strictOrder, String key, String... keys)
      Construct with the keys to find - a varargs with a minimum of 1 argument
      Parameters:
      strictOrder - whether the order must be maintained between the key list and the loaded JSON
      key - the first key
      keys - additional keys
  • Method Details

    • 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