| OLD | NEW |
| 1 library java.junit; | 1 library java.junit; |
| 2 | 2 |
| 3 import 'package:unittest/unittest.dart' hide fail; | 3 import 'package:unittest/unittest.dart' hide fail; |
| 4 import 'package:unittest/unittest.dart' as _ut show fail; | 4 import 'package:unittest/unittest.dart' as _ut show fail; |
| 5 | 5 |
| 6 | 6 |
| 7 class JUnitTestCase { | 7 class JUnitTestCase { |
| 8 void setUp() {} | 8 void setUp() {} |
| 9 void tearDown() {} | 9 void tearDown() {} |
| 10 static void fail(String msg) { | 10 static void fail(String msg) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } finally { | 49 } finally { |
| 50 testInstance.tearDown(); | 50 testInstance.tearDown(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * Returns a matches that matches if the value is not the same instance as "obje
ct" (`!==`). | 55 * Returns a matches that matches if the value is not the same instance as "obje
ct" (`!==`). |
| 56 */ | 56 */ |
| 57 Matcher notSame(expected) => new _IsNotSameAs(expected); | 57 Matcher notSame(expected) => new _IsNotSameAs(expected); |
| 58 | 58 |
| 59 class _IsNotSameAs extends BaseMatcher { | 59 class _IsNotSameAs extends Matcher { |
| 60 final _expected; | 60 final _expected; |
| 61 const _IsNotSameAs(this._expected); | 61 const _IsNotSameAs(this._expected); |
| 62 bool matches(item, Map matchState) => !identical(item, _expected); | 62 bool matches(item, Map matchState) => !identical(item, _expected); |
| 63 Description describe(Description description) => | 63 Description describe(Description description) => |
| 64 description.add('not same instance as ').addDescriptionOf(_expected); | 64 description.add('not same instance as ').addDescriptionOf(_expected); |
| 65 } | 65 } |
| 66 | 66 |
| 67 Matcher equalsMsg(String msg, expected) => new _EqualsWithMessage(msg, expected)
; | 67 Matcher equalsMsg(String msg, expected) => new _EqualsWithMessage(msg, expected)
; |
| 68 class _EqualsWithMessage extends BaseMatcher { | 68 class _EqualsWithMessage extends Matcher { |
| 69 final String msg; | 69 final String msg; |
| 70 final expectedValue; | 70 final expectedValue; |
| 71 const _EqualsWithMessage(this.msg, this.expectedValue); | 71 const _EqualsWithMessage(this.msg, this.expectedValue); |
| 72 bool matches(item, Map matchState) { | 72 bool matches(item, Map matchState) { |
| 73 return item == expectedValue; | 73 return item == expectedValue; |
| 74 } | 74 } |
| 75 Description describe(Description mismatchDescription) { | 75 Description describe(Description mismatchDescription) { |
| 76 return mismatchDescription.replace(msg); | 76 return mismatchDescription.replace(msg); |
| 77 } | 77 } |
| 78 Description describeMismatch(item, Description mismatchDescription, | 78 Description describeMismatch(item, Description mismatchDescription, |
| 79 Map matchState, bool verbose) { | 79 Map matchState, bool verbose) { |
| 80 return mismatchDescription.replace(msg).add(" $item != $expectedValue"); | 80 return mismatchDescription.replace(msg).add(" $item != $expectedValue"); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg); | 84 Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg); |
| 85 class _IsTrueWithMessage extends BaseMatcher { | 85 class _IsTrueWithMessage extends Matcher { |
| 86 final String msg; | 86 final String msg; |
| 87 const _IsTrueWithMessage(this.msg); | 87 const _IsTrueWithMessage(this.msg); |
| 88 bool matches(item, Map matchState) { | 88 bool matches(item, Map matchState) { |
| 89 return item == true; | 89 return item == true; |
| 90 } | 90 } |
| 91 Description describe(Description mismatchDescription) { | 91 Description describe(Description mismatchDescription) { |
| 92 return mismatchDescription.replace(msg); | 92 return mismatchDescription.replace(msg); |
| 93 } | 93 } |
| 94 Description describeMismatch(item, Description mismatchDescription, | 94 Description describeMismatch(item, Description mismatchDescription, |
| 95 Map matchState, bool verbose) { | 95 Map matchState, bool verbose) { |
| 96 return mismatchDescription.replace(msg).add(" $item is not true"); | 96 return mismatchDescription.replace(msg).add(" $item is not true"); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg); | 100 Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg); |
| 101 class _IsFalseWithMessage extends BaseMatcher { | 101 class _IsFalseWithMessage extends Matcher { |
| 102 final String msg; | 102 final String msg; |
| 103 const _IsFalseWithMessage(this.msg); | 103 const _IsFalseWithMessage(this.msg); |
| 104 bool matches(item, Map matchState) { | 104 bool matches(item, Map matchState) { |
| 105 return item == false; | 105 return item == false; |
| 106 } | 106 } |
| 107 Description describe(Description mismatchDescription) { | 107 Description describe(Description mismatchDescription) { |
| 108 return mismatchDescription.replace(msg); | 108 return mismatchDescription.replace(msg); |
| 109 } | 109 } |
| 110 Description describeMismatch(item, Description mismatchDescription, | 110 Description describeMismatch(item, Description mismatchDescription, |
| 111 Map matchState, bool verbose) { | 111 Map matchState, bool verbose) { |
| 112 return mismatchDescription.replace(msg).add(" $item is not false"); | 112 return mismatchDescription.replace(msg).add(" $item is not false"); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg); | 116 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg); |
| 117 class _IsNotNullWithMessage extends BaseMatcher { | 117 class _IsNotNullWithMessage extends Matcher { |
| 118 final String msg; | 118 final String msg; |
| 119 const _IsNotNullWithMessage(this.msg); | 119 const _IsNotNullWithMessage(this.msg); |
| 120 bool matches(item, Map matchState) { | 120 bool matches(item, Map matchState) { |
| 121 return item != null; | 121 return item != null; |
| 122 } | 122 } |
| 123 Description describe(Description mismatchDescription) { | 123 Description describe(Description mismatchDescription) { |
| 124 return mismatchDescription.replace(msg); | 124 return mismatchDescription.replace(msg); |
| 125 } | 125 } |
| 126 Description describeMismatch(item, Description mismatchDescription, | 126 Description describeMismatch(item, Description mismatchDescription, |
| 127 Map matchState, bool verbose) { | 127 Map matchState, bool verbose) { |
| 128 return mismatchDescription.replace(msg).add(" $item is null"); | 128 return mismatchDescription.replace(msg).add(" $item is null"); |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |