| 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 10 matching lines...) Expand all Loading... |
| 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 assertNotNull(x) { | 28 static void assertNotNull(x) { |
| 29 expect(x, isNotNull); | 29 expect(x, isNotNull); |
| 30 } | 30 } |
| 31 static void assertNotNullMsg(String msg, x) { |
| 32 expect(x, isNotNullMsg(msg)); |
| 33 } |
| 31 static void assertEquals(expected, actual) { | 34 static void assertEquals(expected, actual) { |
| 32 expect(actual, equals(expected)); | 35 expect(actual, equals(expected)); |
| 33 } | 36 } |
| 34 static void assertEqualsMsg(String msg, expected, actual) { | 37 static void assertEqualsMsg(String msg, expected, actual) { |
| 35 expect(actual, equalsMsg(msg, expected)); | 38 expect(actual, equalsMsg(msg, expected)); |
| 36 } | 39 } |
| 37 static void assertSame(expected, actual) { | 40 static void assertSame(expected, actual) { |
| 38 expect(actual, same(expected)); | 41 expect(actual, same(expected)); |
| 39 } | 42 } |
| 40 } | 43 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return item == false; | 106 return item == false; |
| 104 } | 107 } |
| 105 Description describe(Description mismatchDescription) { | 108 Description describe(Description mismatchDescription) { |
| 106 return mismatchDescription.replace(msg); | 109 return mismatchDescription.replace(msg); |
| 107 } | 110 } |
| 108 Description describeMismatch(item, Description mismatchDescription, | 111 Description describeMismatch(item, Description mismatchDescription, |
| 109 MatchState matchState, bool verbose) { | 112 MatchState matchState, bool verbose) { |
| 110 return mismatchDescription.replace(msg).add(" $item is not false"); | 113 return mismatchDescription.replace(msg).add(" $item is not false"); |
| 111 } | 114 } |
| 112 } | 115 } |
| 116 |
| 117 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg); |
| 118 class _IsNotNullWithMessage extends BaseMatcher { |
| 119 final String msg; |
| 120 const _IsNotNullWithMessage(this.msg); |
| 121 bool matches(item, MatchState matchState) { |
| 122 return item != null; |
| 123 } |
| 124 Description describe(Description mismatchDescription) { |
| 125 return mismatchDescription.replace(msg); |
| 126 } |
| 127 Description describeMismatch(item, Description mismatchDescription, |
| 128 MatchState matchState, bool verbose) { |
| 129 return mismatchDescription.replace(msg).add(" $item is null"); |
| 130 } |
| 131 } |
| OLD | NEW |