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
Iterable s 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
Iterable s that matches when a single pass over the
examined Iterable yields an item count that satisfies the specified
matcher. |
describeTo, matchesSafely
describeMismatch, matches
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
public IsIterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(java.lang.Iterable<E> actual)
FeatureMatcher
featureValueOf
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)
Iterable
s 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 Iterable
public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)
Iterable
s 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