org.hamcrest.collection
Class IsIterableWithSize<E>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeDiagnosingMatcher<T>
org.hamcrest.FeatureMatcher<Iterable<E>,Integer>
org.hamcrest.collection.IsIterableWithSize<E>
- All Implemented Interfaces:
- Matcher<Iterable<E>>, SelfDescribing
public class IsIterableWithSize<E>
- extends FeatureMatcher<Iterable<E>,Integer>
IsIterableWithSize
public IsIterableWithSize(Matcher<? super Integer> sizeMatcher)
featureValueOf
protected Integer featureValueOf(Iterable<E> actual)
- Specified by:
featureValueOf in class FeatureMatcher<Iterable<E>,Integer>
iterableWithSize
public static <E> Matcher<Iterable<E>> iterableWithSize(Matcher<? super Integer> sizeMatcher)
- Creates a matcher for
Iterables that matches when a single pass over the
examined Iterable yields an item count that satisfies the specified
matcher.
For example:
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))
- Parameters:
sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterable
iterableWithSize
public static <E> Matcher<Iterable<E>> iterableWithSize(int size)
- Creates a matcher for
Iterables that matches when a single pass over the
examined Iterable yields an item count that is equal to the specified
size argument.
For example:
assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
- Parameters:
size - the number of items that should be yielded by an examined Iterable
Copyright © 2014. All rights reserved.