Class ArrayContains

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

public class ArrayContains extends Object implements Condition
Array content conditions
  • Constructor Details

    • ArrayContains

      public ArrayContains(String description, List<Condition> arrayElementConditions, boolean requireStrict)
      Construct the array contains condition
      Parameters:
      description - the name to use - as simple as possible
      arrayElementConditions - the per element conditions
      requireStrict - whether the conditions are executed in strict order
  • Method Details

    • containsValues

      public static ArrayContains containsValues(Object first, Object... rest)
      Create the condition to match the provided values in the array
      Parameters:
      first - first value
      rest - remaining values
      Returns:
      the ArrayContains to find these values within the array
    • containsValues

      public static ArrayContains containsValues(ConditionList conditions)
      Create the condition to match the provided conditions in the array
      Parameters:
      conditions - the conditions
      Returns:
      the ArrayContains to find elements matching these conditions
    • containsValuesExactly

      public static ArrayContains containsValuesExactly(Object first, Object... rest)
      Create the condition to match the provided values in the array in exact order
      Parameters:
      first - first value
      rest - remaining values
      Returns:
      the ArrayContains to match the array with these values
    • containsValuesExactly

      public static ArrayContains containsValuesExactly(ConditionList conditions)
      Create the condition to match the provided condition list in the array in exact order
      Parameters:
      conditions - conditions
      Returns:
      the ArrayContains to match the array with these conditions
    • 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