3
3
import org .hamcrest .AbstractMatcherTest ;
4
4
import org .hamcrest .Matcher ;
5
5
6
+ import static org .hamcrest .collection .ArrayMatching .arrayContaining ;
6
7
import static org .hamcrest .core .IsEqual .equalTo ;
7
8
8
9
public class IsArrayContainingInOrderTest extends AbstractMatcherTest {
9
10
10
11
@ SuppressWarnings ("unchecked" )
11
12
@ Override
12
13
protected Matcher <?> createMatcher () {
13
- return ArrayMatching . arrayContaining (equalTo (1 ), equalTo (2 ));
14
+ return arrayContaining (equalTo (1 ), equalTo (2 ));
14
15
}
15
16
16
17
@ SuppressWarnings ("unchecked" )
17
18
public void testHasAReadableDescription () {
18
- assertDescription ("[<1>, <2>]" , ArrayMatching . arrayContaining (equalTo (1 ), equalTo (2 )));
19
+ assertDescription ("[<1>, <2>]" , arrayContaining (equalTo (1 ), equalTo (2 )));
19
20
}
20
21
21
22
public void testMatchesItemsInOrder () {
22
- assertMatches ("in order" , ArrayMatching . arrayContaining (1 , 2 , 3 ), new Integer [] {1 , 2 , 3 });
23
- assertMatches ("single" , ArrayMatching . arrayContaining (1 ), new Integer [] {1 });
23
+ assertMatches ("in order" , arrayContaining (1 , 2 , 3 ), new Integer [] {1 , 2 , 3 });
24
+ assertMatches ("single" , arrayContaining (1 ), new Integer [] {1 });
24
25
}
25
26
26
27
@ SuppressWarnings ("unchecked" )
27
28
public void testAppliesMatchersInOrder () {
28
- assertMatches ("in order" , ArrayMatching . arrayContaining (equalTo (1 ), equalTo (2 ), equalTo (3 )), new Integer [] {1 , 2 , 3 });
29
- assertMatches ("single" , ArrayMatching . arrayContaining (equalTo (1 )), new Integer [] {1 });
29
+ assertMatches ("in order" , arrayContaining (equalTo (1 ), equalTo (2 ), equalTo (3 )), new Integer [] {1 , 2 , 3 });
30
+ assertMatches ("single" , arrayContaining (equalTo (1 )), new Integer [] {1 });
30
31
}
31
32
32
33
public void testMismatchesItemsInOrder () {
33
- Matcher <Integer []> matcher = ArrayMatching . arrayContaining (1 , 2 , 3 );
34
+ Matcher <Integer []> matcher = arrayContaining (1 , 2 , 3 );
34
35
assertMismatchDescription ("was null" , matcher , null );
35
36
assertMismatchDescription ("no item was <1>" , matcher , new Integer [] {});
36
37
assertMismatchDescription ("no item was <2>" , matcher , new Integer [] {1 });
@@ -39,6 +40,6 @@ public void testMismatchesItemsInOrder() {
39
40
}
40
41
41
42
public void testCanHandleNullValuesInAnArray () {
42
- assertMatches ("with nulls" , ArrayMatching . arrayContaining (null , null ), new Object []{null , null });
43
+ assertMatches ("with nulls" , arrayContaining (null , null ), new Object []{null , null });
43
44
}
44
45
}
0 commit comments