Dart API ReferenceunittestFailureHandler

FailureHandler abstract class

Failed matches are reported using a default IFailureHandler. The default implementation simply throws ExpectExceptions; this can be replaced by some other implementation of IFailureHandler by calling configureExpectHandler.

abstract class FailureHandler {
  /** This handles failures given a textual decription */
  abstract void fail(String reason);

  /**
   * This handles failures given the actual [value], the [matcher]
   * the [reason] (argument from [expect]), some additonal [matchState]
   * generated by the [matcher], and a verbose flag which controls in
   * some cases how much [matchState] information is used. It will use
   * these to create a detailed error message (typically by calling
   * an [ErrorFormatter]) and then call [fail] with this message.
   */
  abstract void failMatch(actual, Matcher matcher, String reason,
                 MatchState matchState, bool verbose);
}

Subclasses

DefaultFailureHandler

Methods

abstract void fail(String reason) #

This handles failures given a textual decription

abstract void failMatch(actual, Matcher matcher, String reason, MatchState matchState, bool verbose) #

This handles failures given the actual value, the matcher the reason (argument from expect), some additonal matchState generated by the matcher, and a verbose flag which controls in some cases how much matchState information is used. It will use these to create a detailed error message (typically by calling an ErrorFormatter) and then call fail with this message.