IsIterableWithSize extends org.hamcrest.collection.IsIterableWithSize<E> { @Override protected Integer featureValueOf(final Iterable<E> actual) { return IterableUtils.size(actual); } IsIterableWithSize(final int size); static Matcher<Iterable<E>> hasSizeOne(); static Matcher<Iterable<E>> hasSizeTwo(); static Matcher<Iterable<E>> hasSizeThree(); static Matcher<Iterable<E>> hasSizeFour(); static Matcher<Iterable<E>> hasSizeFive(); static Matcher<Iterable<E>> hasSize(final int size);  }
@Test public void testFeatureValueOf() throws Exception { final int expectedSize = 100; final Iterable<Object> iterableWithExpectedSize = createIterableWithSize(expectedSize); final IsIterableWithSize<Object> isIterableWithSizeMatcher = new IsIterableWithSize(expectedSize); final int calculatedSize = isIterableWithSizeMatcher.featureValueOf(iterableWithExpectedSize); assertThat(calculatedSize, is(expectedSize)); }