10
10
import org .hamcrest .FeatureMatcher ;
11
11
import org .hamcrest .Matcher ;
12
12
13
+ @ SuppressWarnings ("unchecked" )
13
14
public class IsIterableContainingInOrderTest extends AbstractMatcherTest {
15
+ private final Matcher <Iterable <WithValue >> contains123 = contains (value (1 ), value (2 ), value (3 ));
14
16
15
17
@ Override
16
18
protected Matcher <?> createMatcher () {
@@ -29,18 +31,16 @@ public void testDoesNotMatchWithMoreElementsThanExpected() throws Exception {
29
31
assertMismatchDescription ("Not matched: <4>" , contains (1 , 2 , 3 ), asList (1 , 2 , 3 , 4 ));
30
32
}
31
33
32
- @ SuppressWarnings ("unchecked" )
33
34
public void testDoesNotMatchWithFewerElementsThanExpected () throws Exception {
34
- assertMismatchDescription ("No item: value with <3>" , contains ( value ( 1 ), value ( 2 ), value ( 3 )) , asList (make (1 ), make (2 )));
35
+ assertMismatchDescription ("No item: value with <3>" , contains123 , asList (make (1 ), make (2 )));
35
36
}
36
37
37
38
public void testDoesNotMatchIfSingleItemMismatches () throws Exception {
38
39
assertMismatchDescription ("item 0: value was <3>" , contains (value (4 )), asList (make (3 )));
39
40
}
40
41
41
- @ SuppressWarnings ("unchecked" )
42
42
public void testDoesNotMatchIfOneOfMultipleItemsMismatch () throws Exception {
43
- assertMismatchDescription ("item 2: value was <4>" , contains ( value ( 1 ), value ( 2 ), value ( 3 )) , asList (make (1 ), make (2 ), make (4 )));
43
+ assertMismatchDescription ("item 2: value was <4>" , contains123 , asList (make (1 ), make (2 ), make (4 )));
44
44
}
45
45
46
46
public void testDoesNotMatchEmptyIterable () throws Exception {
0 commit comments