Class Result

java.lang.Object
uk.org.webcompere.modelassert.json.Result

public class Result extends Object
The result of comparison. A mutable object passed through conditions to reach a pass/fail with some explanation of why
  • Constructor Details

    • Result

      public Result(String condition, String was, boolean isPassed)
      Construct a result
      Parameters:
      condition - what was the condition being evaluated
      was - what the answer actually was
      isPassed - is this a success?
    • Result

      public Result(Supplier<String> conditionSupplier, String was, boolean isPassed)
      Construct a result
      Parameters:
      conditionSupplier - supplies the condition being evaluated
      was - what the answer actually was
      isPassed - is this a success?
  • Method Details

    • getCondition

      public String getCondition()
    • withPreCondition

      public Result withPreCondition(String condition)
      Add a prefix to the condition description
      Parameters:
      condition - the prefix to add
      Returns:
      this for fluent calls
    • withNewDescription

      public Result withNewDescription(String condition)
      Change the description of the condition
      Parameters:
      condition - new description
      Returns:
      this for fluent calls
    • getWas

      public String getWas()
    • isPassed

      public boolean isPassed()
    • invert

      public Result invert()
      Flip the result
      Returns:
      this for fluent calls