20
20
import static junit .framework .Assert .assertEquals ;
21
21
import static junit .framework .Assert .assertFalse ;
22
22
import static junit .framework .Assert .assertTrue ;
23
+ import static junit .framework .Assert .fail ;
23
24
24
25
import com .google .common .annotations .GwtCompatible ;
25
26
import com .google .common .annotations .GwtIncompatible ;
40
41
import java .util .Map ;
41
42
import java .util .Map .Entry ;
42
43
import java .util .Set ;
43
- import junit .framework .Assert ;
44
- import junit .framework .AssertionFailedError ;
45
44
import org .checkerframework .checker .nullness .qual .Nullable ;
46
45
47
46
@ GwtCompatible (emulated = true )
@@ -88,13 +87,13 @@ private static boolean isEmpty(Iterable<?> iterable) {
88
87
89
88
public static void assertEmpty (Iterable <?> iterable ) {
90
89
if (!isEmpty (iterable )) {
91
- Assert . fail ("Not true that " + iterable + " is empty" );
90
+ fail ("Not true that " + iterable + " is empty" );
92
91
}
93
92
}
94
93
95
94
public static void assertEmpty (Map <?, ?> map ) {
96
95
if (!map .isEmpty ()) {
97
- Assert . fail ("Not true that " + map + " is empty" );
96
+ fail ("Not true that " + map + " is empty" );
98
97
}
99
98
}
100
99
@@ -104,7 +103,7 @@ public static void assertEqualInOrder(Iterable<?> expected, Iterable<?> actual)
104
103
105
104
while (expectedIter .hasNext () && actualIter .hasNext ()) {
106
105
if (!equal (expectedIter .next (), actualIter .next ())) {
107
- Assert . fail (
106
+ fail (
108
107
"contents were not equal and in the same order: "
109
108
+ "expected = "
110
109
+ expected
@@ -115,7 +114,7 @@ public static void assertEqualInOrder(Iterable<?> expected, Iterable<?> actual)
115
114
116
115
if (expectedIter .hasNext () || actualIter .hasNext ()) {
117
116
// actual either had too few or too many elements
118
- Assert . fail (
117
+ fail (
119
118
"contents were not equal and in the same order: "
120
119
+ "expected = "
121
120
+ expected
@@ -139,7 +138,7 @@ public static void assertEqualIgnoringOrder(Iterable<?> expected, Iterable<?> ac
139
138
// Yeah it's n^2.
140
139
for (Object object : exp ) {
141
140
if (!act .remove (object )) {
142
- Assert . fail (
141
+ fail (
143
142
"did not contain expected element "
144
143
+ object
145
144
+ ", "
@@ -170,7 +169,7 @@ public static void assertContains(Iterable<?> actual, Object expected) {
170
169
}
171
170
172
171
if (!contained ) {
173
- Assert . fail ("Not true that " + actual + " contains " + expected );
172
+ fail ("Not true that " + actual + " contains " + expected );
174
173
}
175
174
}
176
175
@@ -182,7 +181,7 @@ public static void assertContainsAllOf(Iterable<?> actual, Object... expected) {
182
181
}
183
182
184
183
if (!expectedList .isEmpty ()) {
185
- Assert . fail ("Not true that " + actual + " contains all of " + Arrays .asList (expected ));
184
+ fail ("Not true that " + actual + " contains all of " + Arrays .asList (expected ));
186
185
}
187
186
}
188
187
@@ -252,12 +251,6 @@ public void remove() {
252
251
return iterator .next ();
253
252
}
254
253
255
- static void fail (Throwable cause , Object message ) {
256
- AssertionFailedError assertionFailedError = new AssertionFailedError (String .valueOf (message ));
257
- assertionFailedError .initCause (cause );
258
- throw assertionFailedError ;
259
- }
260
-
261
254
private static class EntryComparator <K extends @ Nullable Object , V extends @ Nullable Object >
262
255
implements Comparator <Entry <K , V >> {
263
256
final @ Nullable Comparator <? super K > keyComparator ;
0 commit comments