| 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) { |
| 11 _ut.fail(msg); | 11 _ut.fail(msg); |
| 12 } | 12 } |
| 13 static void assertTrue(bool x) { | 13 static void assertTrue(bool x) { |
| 14 expect(x, isTrue); | 14 expect(x, isTrue); |
| 15 } | 15 } |
| 16 static void assertTrueMsg(String msg, bool x) { | 16 static void assertTrueMsg(String msg, bool x) { |
| 17 expect(x, isTrueMsg(msg)); | 17 expect(x, isTrueMsg(msg)); |
| 18 } | 18 } |
| 19 static void assertFalse(bool x) { | 19 static void assertFalse(bool x) { |
| 20 expect(x, isFalse); | 20 expect(x, isFalse); |
| 21 } | 21 } |
| 22 static void assertFalseMsg(String msg, bool x) { | 22 static void assertFalseMsg(String msg, bool x) { |
| 23 expect(x, isFalseMsg(msg)); | 23 expect(x, isFalseMsg(msg)); |
| 24 } | 24 } |
| 25 static void assertNull(x) { | 25 static void assertNull(x) { |
| 26 expect(x, isNull); | 26 expect(x, isNull); |
| 27 } | 27 } |
| 28 static void assertNullMsg(String msg, x) { |
| 29 expect(x, isNullMsg(msg)); |
| 30 } |
| 28 static void assertNotNull(x) { | 31 static void assertNotNull(x) { |
| 29 expect(x, isNotNull); | 32 expect(x, isNotNull); |
| 30 } | 33 } |
| 31 static void assertNotNullMsg(String msg, x) { | 34 static void assertNotNullMsg(String msg, x) { |
| 32 expect(x, isNotNullMsg(msg)); | 35 expect(x, isNotNullMsg(msg)); |
| 33 } | 36 } |
| 34 static void assertEquals(expected, actual) { | 37 static void assertEquals(expected, actual) { |
| 35 expect(actual, equals(expected)); | 38 expect(actual, equals(expected)); |
| 36 } | 39 } |
| 37 static void assertEqualsMsg(String msg, expected, actual) { | 40 static void assertEqualsMsg(String msg, expected, actual) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 final String msg; | 112 final String msg; |
| 110 const _IsFalseWithMessage(this.msg); | 113 const _IsFalseWithMessage(this.msg); |
| 111 bool matches(item, Map matchState) { | 114 bool matches(item, Map matchState) { |
| 112 return item == false; | 115 return item == false; |
| 113 } | 116 } |
| 114 Description describe(Description mismatchDescription) { | 117 Description describe(Description mismatchDescription) { |
| 115 return mismatchDescription.replace(msg); | 118 return mismatchDescription.replace(msg); |
| 116 } | 119 } |
| 117 } | 120 } |
| 118 | 121 |
| 122 Matcher isNullMsg(String msg) => new _IsNullWithMessage(msg); |
| 123 class _IsNullWithMessage extends Matcher { |
| 124 final String msg; |
| 125 const _IsNullWithMessage(this.msg); |
| 126 bool matches(item, Map matchState) { |
| 127 return item == null; |
| 128 } |
| 129 Description describe(Description mismatchDescription) { |
| 130 return mismatchDescription.replace(msg); |
| 131 } |
| 132 } |
| 133 |
| 119 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg); | 134 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg); |
| 120 class _IsNotNullWithMessage extends Matcher { | 135 class _IsNotNullWithMessage extends Matcher { |
| 121 final String msg; | 136 final String msg; |
| 122 const _IsNotNullWithMessage(this.msg); | 137 const _IsNotNullWithMessage(this.msg); |
| 123 bool matches(item, Map matchState) { | 138 bool matches(item, Map matchState) { |
| 124 return item != null; | 139 return item != null; |
| 125 } | 140 } |
| 126 Description describe(Description mismatchDescription) { | 141 Description describe(Description mismatchDescription) { |
| 127 return mismatchDescription.replace(msg); | 142 return mismatchDescription.replace(msg); |
| 128 } | 143 } |
| 129 } | 144 } |
| OLD | NEW |