File tree Expand file tree Collapse file tree
test/java/org/hamcrest/collection Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .hamcrest ;
22
33import org .hamcrest .collection .MatchArrays ;
4+ import org .hamcrest .collection .MatchCollections ;
45import org .hamcrest .collection .MatchIterables ;
56import org .hamcrest .number .MatchNumbers ;
67import org .hamcrest .object .MatchObjects ;
@@ -725,7 +726,7 @@ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> hasSiz
725726 * <pre>assertThat(new ArrayList<String>(), is(empty()))</pre>
726727 */
727728 public static <E > org .hamcrest .Matcher <java .util .Collection <? extends E >> empty () {
728- return org . hamcrest . collection . IsEmptyCollection .empty ();
729+ return MatchCollections .empty ();
729730 }
730731
731732 /**
@@ -737,7 +738,7 @@ public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> empty(
737738 * @param unusedToForceReturnType the type of the collection's content
738739 */
739740 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 );
741742 }
742743
743744 /**
Original file line number Diff line number Diff line change 11package org .hamcrest .collection ;
22
33import org .hamcrest .Description ;
4- import org .hamcrest .Matcher ;
54import org .hamcrest .TypeSafeMatcher ;
65
76import java .util .Collection ;
@@ -26,28 +25,4 @@ public void describeTo(Description description) {
2625 description .appendText ("an empty collection" );
2726 }
2827
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- }
5328}
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public static <E> Matcher<Collection<? extends E>> empty() {
5252 *
5353 * @param unusedToForceReturnType the type of the collection's content
5454 */
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 ();
5758 }
5859}
Original file line number Diff line number Diff line change 77import java .util .Collection ;
88
99import static java .util .Arrays .asList ;
10- import static org .hamcrest .collection .IsEmptyCollection .empty ;
10+ import static org .hamcrest .collection .MatchCollections .empty ;
1111import static org .hamcrest .core .Is .is ;
1212
1313public class IsEmptyCollectionTest extends AbstractMatcherTest {
@@ -30,7 +30,7 @@ public void testHasAReadableDescription() {
3030 }
3131
3232 public void testCompiles () {
33- needs (IsEmptyCollection .emptyCollectionOf (String .class ));
33+ needs (MatchCollections .emptyCollectionOf (String .class ));
3434 }
3535
3636 private void needs (@ SuppressWarnings ("unused" ) Matcher <Collection <String >> bar ) { }
You can’t perform that action at this time.
0 commit comments