public class IsIterableWithSize<E> extends FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>
| Constructor and Description |
|---|
IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Integer |
featureValueOf(java.lang.Iterable<E> actual)
Implement this to extract the interesting feature.
|
static <E> Matcher<java.lang.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. |
static <E> Matcher<java.lang.Iterable<E>> |
iterableWithSize(Matcher<? super java.lang.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. |
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringpublic IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.lang.Iterable<E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
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)))sizeMatcher - a matcher for the number of items that should be yielded by an examined Iterablepublic static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
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))size - the number of items that should be yielded by an examined Iterable