| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * Returns a matcher that matches empty strings, maps or collections. | 7 * Returns a matcher that matches empty strings, maps or collections. |
| 8 */ | 8 */ |
| 9 const Matcher isEmpty = const _Empty(); | 9 const Matcher isEmpty = const _Empty(); |
| 10 | 10 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 /** A matcher for functions that throw NotNullPointerException */ | 489 /** A matcher for functions that throw NotNullPointerException */ |
| 490 const Matcher throwsNullPointerException = | 490 const Matcher throwsNullPointerException = |
| 491 const Throws(isNullPointerException); | 491 const Throws(isNullPointerException); |
| 492 | 492 |
| 493 class _NullPointerException extends ExceptionMatcher { | 493 class _NullPointerException extends ExceptionMatcher { |
| 494 const _NullPointerException() : super("NullPointerException"); | 494 const _NullPointerException() : super("NullPointerException"); |
| 495 bool matches(item, MatchState matchState) => item is NullPointerException; | 495 bool matches(item, MatchState matchState) => item is NullPointerException; |
| 496 } | 496 } |
| 497 | 497 |
| 498 /** A matcher for UnsupportedOperationExceptions. */ | 498 /** A matcher for StateErrors. */ |
| 499 const isUnsupportedOperationException = const _UnsupportedOperationException(); | 499 const isStateError = const _StateError(); |
| 500 | 500 |
| 501 /** A matcher for functions that throw UnsupportedOperationException */ | 501 /** A matcher for functions that throw StateError */ |
| 502 const Matcher throwsUnsupportedOperationException = | 502 const Matcher throwsStateError = |
| 503 const Throws(isUnsupportedOperationException); | 503 const Throws(isStateError); |
| 504 | 504 |
| 505 class _UnsupportedOperationException extends ExceptionMatcher { | 505 class _StateError extends ExceptionMatcher { |
| 506 const _UnsupportedOperationException() : | 506 const _StateError() : |
| 507 super("UnsupportedOperationException"); | 507 super("StateError"); |
| 508 bool matches(item, MatchState matchState) => | 508 bool matches(item, MatchState matchState) => |
| 509 item is UnsupportedOperationException; | 509 item is StateError; |
| 510 } | 510 } |
| 511 | 511 |
| 512 /** | 512 /** |
| 513 * Returns a matcher that matches if an object has a length property | 513 * Returns a matcher that matches if an object has a length property |
| 514 * that matches [matcher]. | 514 * that matches [matcher]. |
| 515 */ | 515 */ |
| 516 Matcher hasLength(matcher) => | 516 Matcher hasLength(matcher) => |
| 517 new _HasLength(wrapMatcher(matcher)); | 517 new _HasLength(wrapMatcher(matcher)); |
| 518 | 518 |
| 519 class _HasLength extends BaseMatcher { | 519 class _HasLength extends BaseMatcher { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 final _matcher; | 618 final _matcher; |
| 619 final String _description; | 619 final String _description; |
| 620 | 620 |
| 621 const _Predicate(this._matcher, this._description); | 621 const _Predicate(this._matcher, this._description); |
| 622 | 622 |
| 623 bool matches(item, MatchState matchState) => _matcher(item); | 623 bool matches(item, MatchState matchState) => _matcher(item); |
| 624 | 624 |
| 625 Description describe(Description description) => | 625 Description describe(Description description) => |
| 626 description.add(_description); | 626 description.add(_description); |
| 627 } | 627 } |
| OLD | NEW |