Class NumberCondition<N extends Number>

java.lang.Object
uk.org.webcompere.modelassert.json.condition.NumberCondition<N>
Type Parameters:
N - the type of number being compared with
All Implemented Interfaces:
Condition

public class NumberCondition<N extends Number> extends Object implements Condition
Numeric comparisons
  • Constructor Details

    • NumberCondition

      public NumberCondition(N expected, NumberCondition.Comparison comparison)
      Construct a number condition for any numeric type
      Parameters:
      expected - the expected value
      comparison - the comparison to be true
    • NumberCondition

      public NumberCondition(Class<N> requiredType, N expected, NumberCondition.Comparison comparison)
      Construct a number condition for a specific numeric type
      Parameters:
      requiredType - the type of number the value must be
      expected - the expected value
      comparison - the comparison to be true
  • 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