java.lang.Object
uk.org.webcompere.modelassert.json.condition.HasValue<V>
Type Parameters:
V - the type of value
All Implemented Interfaces:
Condition

public class HasValue<V> extends Object implements Condition
Specific typed "hasValue" comparison
  • Constructor Details

    • HasValue

      public HasValue(Function<com.fasterxml.jackson.databind.JsonNode,V> valueExtractor, V expected)
      Construct the condition
      Parameters:
      valueExtractor - how to extract the right sort of value from the JsonNode
      expected - the expected value
  • Method Details

    • test

      public Result test(com.fasterxml.jackson.databind.JsonNode json)
      Description copied from interface: Condition
      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()
      Description copied from interface: Condition
      Describe the condition
      Specified by:
      describe in interface Condition
      Returns:
      description of the condition