Skip to content

Commit 7d6a0eb

Browse files
author
smgfreeman
committed
added mismatch description test
1 parent 969cf38 commit 7d6a0eb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsEmptyCollectionTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package org.hamcrest.collection;
22

3+
import static org.hamcrest.Matchers.is;
34
import static org.hamcrest.collection.IsEmptyCollection.empty;
45

6+
import java.util.ArrayList;
57
import java.util.Arrays;
8+
import java.util.Collection;
69

710
import org.hamcrest.AbstractMatcherTest;
811
import org.hamcrest.Matcher;
@@ -19,10 +22,14 @@ public void testMatchesAnEmptyCollection() {
1922
}
2023

2124
public void testDoesNotMatchACollectionWithAnItem() {
22-
assertDoesNotMatch("collection with an item", empty(), Arrays.<Object>asList(1));
25+
assertMismatchDescription("<[one, three]>", is(empty()), collectionOfValues());
2326
}
2427

2528
public void testHasAReadableDescription() {
2629
assertDescription("an empty collection", empty());
2730
}
31+
32+
private Collection<Object> collectionOfValues() {
33+
return new ArrayList<Object>() {{ add("one"); add("three"); }};
34+
}
2835
}

0 commit comments

Comments
 (0)