diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java index 7956dabc..966a12c4 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsCollectionWithSizeTest.java @@ -21,48 +21,48 @@ protected Matcher createMatcher() { public void testMatchesWhenSizeIsCorrect() { assertMatches("correct size", hasSize(equalTo(2)), asList(null, null)); - assertMismatchDescription("collection size was <3>", hasSize(equalTo(2)), asList(null, null, null)); + assertDoesNotMatch("incorrect size", hasSize(equalTo(2)), asList(null, null, null)); } public void testMatchesCollectionWhenSizeIsCorrectUsingObjectElementType() { Collection list = asList(null, null); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testMatchesCollectionWhenSizeIsCorrectUsingStringElementType() { Collection list = asList("a", "b"); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testMatchesCollectionWhenSizeIsCorrectUsingWildcardElementType() { Collection list = asList("a", "b"); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testMatchesListWhenSizeIsCorrectUsingObjectElementType() { List list = asList(null, null); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testMatchesListWhenSizeIsCorrectUsingStringElementType() { List list = asList("a", "b"); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testMatchesListWhenSizeIsCorrectUsingWildcardElementType() { List list = asList("a", "b"); assertMatches("correct size", hasSize(equalTo(2)), list); - assertMismatchDescription("collection size was <2>", hasSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", hasSize(equalTo(3)), list); } public void testProvidesConvenientShortcutForHasSizeEqualTo() { assertMatches("correct size", hasSize(2), asList(null, null)); - assertMismatchDescription("collection size was <3>", hasSize(2), asList(null, null, null)); + assertDoesNotMatch("incorrect size", hasSize(2), asList(null, null, null)); } public void testHasAReadableDescription() { diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java index 04f4a42b..f0dac041 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapWithSizeTest.java @@ -22,48 +22,48 @@ protected Matcher createMatcher() { public void testMatchesWhenSizeIsCorrect() { assertMatches("correct size", aMapWithSize(equalTo(2)), mapWithKeys("a", "b")); - assertMismatchDescription("map size was <3>", aMapWithSize(equalTo(2)), mapWithKeys("a", "b", "c")); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(2)), mapWithKeys("a", "b", "c")); } public void testMatchesMapWhenSizeIsCorrectUsingObjectElementType() { Map map = mapWithKeys(new Object(), new Object()); assertMatches("correct size", aMapWithSize(equalTo(2)), map); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), map); } public void testMatchesMapWhenSizeIsCorrectUsingStringElementType() { Map map = mapWithKeys("a", "b"); assertMatches("correct size", aMapWithSize(equalTo(2)), map); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), map); } public void testMatchesMapWhenSizeIsCorrectUsingWildcardElementType() { Map map = mapWithKeys("a", "b"); assertMatches("correct size", aMapWithSize(equalTo(2)), map); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), map); } public void testMatchesListWhenSizeIsCorrectUsingObjectElementType() { Map map = mapWithKeys(new Object(), new Object()); assertMatches("correct size", aMapWithSize(equalTo(2)), map); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), map); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), map); } public void testMatchesListWhenSizeIsCorrectUsingStringElementType() { Map list = mapWithKeys("a", "b"); assertMatches("correct size", aMapWithSize(equalTo(2)), list); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), list); } public void testMatchesListWhenSizeIsCorrectUsingWildcardElementType() { Map list = mapWithKeys("a", "b"); assertMatches("correct size", aMapWithSize(equalTo(2)), list); - assertMismatchDescription("map size was <2>", aMapWithSize(equalTo(3)), list); + assertDoesNotMatch("incorrect size", aMapWithSize(equalTo(3)), list); } public void testProvidesConvenientShortcutForHasSizeEqualTo() { assertMatches("correct size", aMapWithSize(2), mapWithKeys(new Object(), new Object())); - assertMismatchDescription("map size was <3>", aMapWithSize(2), mapWithKeys(new Object(), new Object(), new Object())); + assertDoesNotMatch("incorrect size", aMapWithSize(2), mapWithKeys(new Object(), new Object(), new Object())); } public void testHasAReadableDescription() { @@ -96,20 +96,4 @@ private static Map mapWithKeysAndValues(List keys, List value } return result; } - - /** - * An object that overrides toString. - */ - private static class MyObject { - private final String state; - - private MyObject(String state) { - this.state = state; - } - - @Override - public String toString() { - return state; - } - } }