Dart API ReferenceunittestDefaultFailureHandler

DefaultFailureHandler class

class DefaultFailureHandler implements FailureHandler {
  DefaultFailureHandler() {
    if (_assertErrorFormatter == null) {
      _assertErrorFormatter = _defaultErrorFormatter;
    }
  }
  void fail(String reason) {
    throw new ExpectException(reason);
  }
  void failMatch(actual, Matcher matcher, String reason,
      MatchState matchState, bool verbose) {
    fail(_assertErrorFormatter(actual, matcher, reason, matchState, verbose));
  }
}

Implements

FailureHandler

Constructors

new DefaultFailureHandler() #

DefaultFailureHandler() {
  if (_assertErrorFormatter == null) {
    _assertErrorFormatter = _defaultErrorFormatter;
  }
}

Methods

void fail(String reason) #

This handles failures given a textual decription

docs inherited from FailureHandler
void fail(String reason) {
  throw new ExpectException(reason);
}

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.

docs inherited from FailureHandler
void failMatch(actual, Matcher matcher, String reason,
    MatchState matchState, bool verbose) {
  fail(_assertErrorFormatter(actual, matcher, reason, matchState, verbose));
}