Package org.hamcrest.collection
Class IsIterableWithSize<E>
- All Implemented Interfaces:
Matcher<Iterable<E>>
,SelfDescribing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Integer
featureValueOf
(Iterable<E> actual) Implement this to extract the interesting feature.iterableWithSize
(int size) iterableWithSize
(Matcher<? super Integer> sizeMatcher) Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
IsIterableWithSize
-
-
Method Details
-
featureValueOf
Description copied from class:FeatureMatcher
Implement this to extract the interesting feature.- Specified by:
featureValueOf
in classFeatureMatcher<Iterable<E>,
Integer> - Parameters:
actual
- the target object- Returns:
- the feature to be matched
-
iterableWithSize
Creates a matcher forIterable
s that matches when a single pass over the examinedIterable
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 examinedIterable
-
iterableWithSize
Creates a matcher forIterable
s that matches when a single pass over the examinedIterable
yields an item count that is equal to the specifiedsize
argument. For example:assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))
- Parameters:
size
- the number of items that should be yielded by an examinedIterable
-