11package org .hamcrest .collection ;
22
3+ import org .hamcrest .FeatureMatcher ;
34import org .hamcrest .Matcher ;
45
56import java .util .Collection ;
67
78import static org .hamcrest .core .DescribedAs .describedAs ;
9+ import static org .hamcrest .core .IsEqual .equalTo ;
810
911public class MatchArrays {
1012 /**
@@ -166,7 +168,9 @@ public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... items) {
166168 * @param sizeMatcher a matcher for the length of an examined array
167169 */
168170 public static <E > Matcher <E []> arrayWithSize (Matcher <? super Integer > sizeMatcher ) {
169- return IsArrayWithSize .arrayWithSize (sizeMatcher );
171+ return new FeatureMatcher <E [], Integer > (sizeMatcher , "an array with size" ,"array size" ) {
172+ @ Override protected Integer featureValueOf (E [] actual ) { return actual .length ; }
173+ };
170174 }
171175
172176 /**
@@ -178,7 +182,7 @@ public static <E> Matcher<E[]> arrayWithSize(Matcher<? super Integer> sizeMatche
178182 * @param size the length that an examined array must have for a positive match
179183 */
180184 public static <E > Matcher <E []> arrayWithSize (int size ) {
181- return IsArrayWithSize . arrayWithSize (size );
185+ return arrayWithSize (equalTo ( size ) );
182186 }
183187
184188 /**
@@ -188,7 +192,7 @@ public static <E> Matcher<E[]> arrayWithSize(int size) {
188192 * <pre>assertThat(new String[0], emptyArray())</pre>
189193 */
190194 public static <E > Matcher <E []> emptyArray () {
191- return describedAs ("an empty array" , IsArrayWithSize .<E >arrayWithSize (0 ));
195+ return describedAs ("an empty array" , MatchArrays .<E >arrayWithSize (0 ));
192196 }
193197
194198}
0 commit comments