Class PredicateWrappedCondition

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

public class PredicateWrappedCondition extends Object implements Condition
A condition which checks a predicate for the node and then delegates to a further condition. This can be used without a further condition, just to test the node type
  • Constructor Details

    • PredicateWrappedCondition

      public PredicateWrappedCondition(String typeName, Predicate<com.fasterxml.jackson.databind.JsonNode> typeDetector)
      Construct the condition
      Parameters:
      typeName - the name of the type for description
      typeDetector - detects if the node's the right type
    • PredicateWrappedCondition

      public PredicateWrappedCondition(String typeName, Predicate<com.fasterxml.jackson.databind.JsonNode> typeDetector, Condition delegate)
      Construct the condition
      Parameters:
      typeName - the name of the type for description
      typeDetector - detects if the node's the right type
      delegate - the condition to hand over to, if the node's of the correct type
  • 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