Skip to content

Commit 2830455

Browse files
committed
Collapsing factory methods isArray
1 parent 67c72cf commit 2830455

File tree

4 files changed

+4
-19
lines changed

4 files changed

+4
-19
lines changed

hamcrest-library/src/main/java/org/hamcrest/Matchers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public static org.hamcrest.Matcher<java.lang.String> endsWithIgnoringCase(java.l
486486
*/
487487
@SafeVarargs
488488
public static <T> org.hamcrest.collection.IsArray<T> array(org.hamcrest.Matcher<? super T>... elementMatchers) {
489-
return org.hamcrest.collection.IsArray.array(elementMatchers);
489+
return MatchArrays.array(elementMatchers);
490490
}
491491

492492
/**

hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,5 @@ protected String descriptionSeparator() {
7979
protected String descriptionEnd() {
8080
return "]";
8181
}
82-
83-
/**
84-
* Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. Matches
85-
* positively only if the number of matchers specified is equal to the length of the examined array and
86-
* each matcher[i] is satisfied by array[i].
87-
* For example:
88-
* <pre>assertThat(new Integer[]{1,2,3}, is(array(equalTo(1), equalTo(2), equalTo(3))))</pre>
89-
*
90-
* @param elementMatchers
91-
* the matchers that the elements of examined arrays should satisfy
92-
*/
93-
@SafeVarargs
94-
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers) {
95-
return new IsArray<>(elementMatchers);
96-
}
9782

9883
}

hamcrest-library/src/main/java/org/hamcrest/collection/MatchArrays.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MatchArrays {
2323
*/
2424
@SafeVarargs
2525
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers) {
26-
return IsArray.array(elementMatchers);
26+
return new IsArray<>(elementMatchers);
2727
}
2828

2929
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import org.hamcrest.Description;
66
import org.hamcrest.Matcher;
77

8-
import static org.hamcrest.collection.IsArray.array;
9-
import static org.hamcrest.core.IsEqual.equalTo;
8+
import static org.hamcrest.collection.MatchArrays.array;
9+
import static org.hamcrest.object.MatchObjects.equalTo;
1010

1111
@SuppressWarnings("unchecked")
1212
public class IsArrayTest extends AbstractMatcherTest {

0 commit comments

Comments
 (0)