Skip to content

Commit 4ca40cc

Browse files
author
joeretro
committed
Simplifed description of equalTo() matcher.
1 parent bee7260 commit 4ca40cc

File tree

7 files changed

+9
-11
lines changed

7 files changed

+9
-11
lines changed

src/library/org/hamcrest/core/IsEqual.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public boolean matches(Object arg) {
2626
}
2727

2828
public void describeTo(Description description) {
29-
description.appendText("eq(")
30-
.appendValue(object)
31-
.appendText(")");
29+
description.appendValue(object);
3230
}
3331

3432
private static boolean areEqual(Object o1, Object o2) {

src/unit-test/org/hamcrest/collection/IsArrayContainingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void testDoesNotMatchNull() {
2828
}
2929

3030
public void testHasAReadableDescription() {
31-
assertDescription("an array containing eq(\"a\")", arrayContaining("a"));
31+
assertDescription("an array containing \"a\"", arrayContaining("a"));
3232
}
3333

3434
// Remaining code no longer compiles, thanks to generics. I think that's a good thing, but

src/unit-test/org/hamcrest/collection/IsArrayTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public void testDoesNotMatchNull() {
3636
}
3737

3838
public void testHasAReadableDescription() {
39-
assertDescription("[eq(\"a\"), eq(\"b\")]", array(equalTo("a"), equalTo("b")));
39+
assertDescription("[\"a\", \"b\"]", array(equalTo("a"), equalTo("b")));
4040
}
4141
}

src/unit-test/org/hamcrest/collection/IsCollectionContainingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void testDoesNotMatchNull() {
3232
}
3333

3434
public void testHasAReadableDescription() {
35-
assertDescription("a collection containing eq(\"a\")", collectionContaining(equalTo("a")));
35+
assertDescription("a collection containing \"a\"", collectionContaining(equalTo("a")));
3636
}
3737

3838
public void testMatchesAllItemsInCollection() {

src/unit-test/org/hamcrest/collection/IsMapContainingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void testDoesNotMatchNull() {
3131
}
3232

3333
public void testHasReadableDescription() {
34-
assertDescription("map containing [eq(\"a\")->eq(<2>)]",
34+
assertDescription("map containing [\"a\"-><2>]",
3535
mapContaining(equalTo("a"), (equalTo(2))));
3636
}
3737

src/unit-test/org/hamcrest/core/IsEqualTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ public String toString() {
7373
return argumentDescription;
7474
}
7575
};
76-
assertDescription("eq(<" + argumentDescription + ">)", equalTo(argument));
76+
assertDescription("<" + argumentDescription + ">", equalTo(argument));
7777
}
7878

7979
public void testReturnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake() {
8080
Matcher<String> innerMatcher = equalTo("NestedMatcher");
81-
assertDescription("eq(<" + innerMatcher.toString() + ">)", equalTo(innerMatcher));
81+
assertDescription("<" + innerMatcher.toString() + ">", equalTo(innerMatcher));
8282
}
8383

8484
public void testReturnsGoodDescriptionIfCreatedWithNullReference() {
85-
assertDescription("eq(null)", equalTo(null));
85+
assertDescription("null", equalTo(null));
8686
}
8787
}
8888

src/unit-test/org/hamcrest/xml/HasXPathTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testThrowsIllegalArgumentExceptionIfGivenIllegalExpression() {
5757
}
5858

5959
public void testDescribesItself() throws Exception {
60-
assertDescription("an XML document with XPath /some/path eq(\"Cheddar\")",
60+
assertDescription("an XML document with XPath /some/path \"Cheddar\"",
6161
hasXPath("/some/path", equalTo("Cheddar")));
6262
assertDescription("an XML document with XPath /some/path",
6363
hasXPath("/some/path"));

0 commit comments

Comments
 (0)