Skip to content

Commit 52d4727

Browse files
author
jon.m.reid
committed
Changed descriptions to noun phrases, and made them more succinct.
1 parent 8d428cf commit 52d4727

18 files changed

Lines changed: 95 additions & 19 deletions

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public boolean matchesSafely(E[] item) {
2727
}
2828

2929
public void describeTo(Description description) {
30-
description.appendText("is array containing in any order: ")
31-
.appendList("[ ", ", ", " ]", matchers);
30+
description.appendList("[", ", ", "]", matchers)
31+
.appendText(" in any order");
3232
}
3333

3434
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public boolean matchesSafely(E[] item) {
2727
}
2828

2929
public void describeTo(Description description) {
30-
description.appendText("is array containing in order: ")
31-
.appendList("[ ", ", ", " ]", matchers);
30+
description.appendList("[", ", ", "]", matchers);
3231
}
3332

3433
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingSingleItem.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public boolean matchesSafely(E[] item) {
2424
}
2525

2626
public void describeTo(Description description) {
27-
description.appendText("is a singleton array with: [ ")
27+
description.appendText("a singleton array with [")
2828
.appendDescriptionOf(itemMatcher)
29-
.appendText(" ]");
29+
.appendText("]");
3030
}
3131

3232
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayWithSize.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public boolean matchesSafely(E[] item) {
2424
}
2525

2626
public void describeTo(Description description) {
27-
description.appendText("is array with size ")
27+
description.appendText("an array with size ")
2828
.appendDescriptionOf(sizeMatcher);
2929
}
3030

@@ -53,6 +53,6 @@ public static <E> Matcher<E[]> arrayWithSize(int size) {
5353
@Factory
5454
public static <E> Matcher<E[]> emptyArray() {
5555
Matcher<E[]> isEmpty = arrayWithSize(0);
56-
return describedAs("is an empty array", isEmpty);
56+
return describedAs("an empty array", isEmpty);
5757
}
5858
}

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyIterable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public boolean matchesSafely(Iterable<E> iterable) {
1616
}
1717

1818
public void describeTo(Description description) {
19-
description.appendText("is an empty iterable");
19+
description.appendText("an empty iterable");
2020
}
2121

2222
/**

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ private List<Matcher<? super T>> copyOfMatchers() {
5050
}
5151

5252
public void describeTo(Description description) {
53-
description.appendText("is iterable containing in any order: ")
54-
.appendList("[ ", ", ", " ]", matchers);
53+
description.appendText("iterable over ")
54+
.appendList("[", ", ", "]", matchers)
55+
.appendText(" in any order");
5556
}
5657

5758
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public boolean matchesSafely(Iterable<E> iterable) {
3636
}
3737

3838
public void describeTo(Description description) {
39-
description.appendText("is iterable containing in order: ")
40-
.appendList("[ ", ", ", " ]", matchers);
39+
description.appendText("iterable over ")
40+
.appendList("[", ", ", "]", matchers);
4141
}
4242

4343
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingSingleItem.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public boolean matchesSafely(Iterable<E> iterable) {
2626
}
2727

2828
public void describeTo(Description description) {
29-
description.appendText("is a singleton iterable with: [ ")
29+
description.appendText("a singleton iterable with [")
3030
.appendDescriptionOf(matcher)
31-
.appendText(" ]");
31+
.appendText("]");
3232
}
3333

3434
@Factory

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableWithSize.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public boolean matchesSafely(Iterable<E> iterable) {
2525
}
2626

2727
public void describeTo(Description description) {
28-
description.appendText("is iterable with size ")
28+
description.appendText("an iterable with size ")
2929
.appendDescriptionOf(sizeMatcher);
3030
}
3131

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.hamcrest.collection;
2+
3+
import static org.hamcrest.collection.IsArrayContainingInAnyOrder.arrayContainingInAnyOrder;
4+
import static org.hamcrest.core.IsEqual.equalTo;
5+
6+
import org.hamcrest.AbstractMatcherTest;
7+
import org.hamcrest.Matcher;
8+
9+
public class IsArrayContainingInAnyOrderTest extends AbstractMatcherTest {
10+
11+
@Override
12+
protected Matcher<?> createMatcher() {
13+
return arrayContainingInAnyOrder(equalTo(1), equalTo(2));
14+
}
15+
16+
public void testHasAReadableDescription() {
17+
assertDescription("[<1>, <2>] in any order",
18+
arrayContainingInAnyOrder(equalTo(1), equalTo(2)));
19+
}
20+
}

0 commit comments

Comments
 (0)