File tree Expand file tree Collapse file tree 4 files changed +8
-31
lines changed
test/java/org/hamcrest/collection Expand file tree Collapse file tree 4 files changed +8
-31
lines changed Original file line number Diff line number Diff line change 1
1
package org .hamcrest ;
2
2
3
3
import org .hamcrest .collection .MatchArrays ;
4
+ import org .hamcrest .collection .MatchCollections ;
4
5
import org .hamcrest .collection .MatchIterables ;
5
6
import org .hamcrest .number .MatchNumbers ;
6
7
import org .hamcrest .object .MatchObjects ;
@@ -725,7 +726,7 @@ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> hasSiz
725
726
* <pre>assertThat(new ArrayList<String>(), is(empty()))</pre>
726
727
*/
727
728
public static <E > org .hamcrest .Matcher <java .util .Collection <? extends E >> empty () {
728
- return org . hamcrest . collection . IsEmptyCollection .empty ();
729
+ return MatchCollections .empty ();
729
730
}
730
731
731
732
/**
@@ -737,7 +738,7 @@ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> empty(
737
738
* @param unusedToForceReturnType the type of the collection's content
738
739
*/
739
740
public static <E > org .hamcrest .Matcher <java .util .Collection <E >> emptyCollectionOf (java .lang .Class <E > unusedToForceReturnType ) {
740
- return org . hamcrest . collection . IsEmptyCollection .emptyCollectionOf (unusedToForceReturnType );
741
+ return MatchCollections .emptyCollectionOf (unusedToForceReturnType );
741
742
}
742
743
743
744
/**
Original file line number Diff line number Diff line change 1
1
package org .hamcrest .collection ;
2
2
3
3
import org .hamcrest .Description ;
4
- import org .hamcrest .Matcher ;
5
4
import org .hamcrest .TypeSafeMatcher ;
6
5
7
6
import java .util .Collection ;
@@ -26,28 +25,4 @@ public void describeTo(Description description) {
26
25
description .appendText ("an empty collection" );
27
26
}
28
27
29
- /**
30
- * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code>
31
- * method returns <code>true</code>.
32
- * For example:
33
- * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre>
34
- *
35
- */
36
- public static <E > Matcher <Collection <? extends E >> empty () {
37
- return new IsEmptyCollection <>();
38
- }
39
-
40
- /**
41
- * Creates a matcher for {@link java.util.Collection}s matching examined collections whose <code>isEmpty</code>
42
- * method returns <code>true</code>.
43
- * For example:
44
- * <pre>assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))</pre>
45
- *
46
- * @param unusedToForceReturnType
47
- * the type of the collection's content
48
- */
49
- @ SuppressWarnings ({"unchecked" , "UnusedParameters" })
50
- public static <E > Matcher <Collection <E >> emptyCollectionOf (Class <E > unusedToForceReturnType ) {
51
- return (Matcher )empty ();
52
- }
53
28
}
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public static <E> Matcher<Collection<? extends E>> empty() {
52
52
*
53
53
* @param unusedToForceReturnType the type of the collection's content
54
54
*/
55
- public static <E > Matcher <Collection <? extends E >> emptyCollectionOf (Class <E > unusedToForceReturnType ) {
56
- return new IsEmptyCollection <>();
55
+ @ SuppressWarnings ("unchecked" )
56
+ public static <E > Matcher <Collection <E >> emptyCollectionOf (Class <E > unusedToForceReturnType ) {
57
+ return (Matcher )empty ();
57
58
}
58
59
}
Original file line number Diff line number Diff line change 7
7
import java .util .Collection ;
8
8
9
9
import static java .util .Arrays .asList ;
10
- import static org .hamcrest .collection .IsEmptyCollection .empty ;
10
+ import static org .hamcrest .collection .MatchCollections .empty ;
11
11
import static org .hamcrest .core .Is .is ;
12
12
13
13
public class IsEmptyCollectionTest extends AbstractMatcherTest {
@@ -30,7 +30,7 @@ public void testHasAReadableDescription() {
30
30
}
31
31
32
32
public void testCompiles () {
33
- needs (IsEmptyCollection .emptyCollectionOf (String .class ));
33
+ needs (MatchCollections .emptyCollectionOf (String .class ));
34
34
}
35
35
36
36
private void needs (@ SuppressWarnings ("unused" ) Matcher <Collection <String >> bar ) { }
You can’t perform that action at this time.
0 commit comments