Package org.hamcrest.collection
Class IsIterableWithSize<E>
java.lang.Object
- Type Parameters:
- E- the iterable element type
- All Implemented Interfaces:
- Matcher<Iterable<E>>,- SelfDescribing
Matches if iterable size satisfies a size matcher.
- 
Constructor SummaryConstructorsConstructorDescriptionIsIterableWithSize(Matcher<? super Integer> sizeMatcher) Constructor, best called fromiterableWithSize(int)oriterableWithSize(Matcher).
- 
Method SummaryModifier and TypeMethodDescriptionprotected IntegerfeatureValueOf(Iterable<E> actual) Implement this to extract the interesting feature.iterableWithSize(int size) iterableWithSize(Matcher<? super Integer> sizeMatcher) Methods inherited from class org.hamcrest.FeatureMatcherdescribeTo, matchesSafelyMethods inherited from class org.hamcrest.TypeSafeDiagnosingMatcherdescribeMismatch, matchesMethods inherited from class org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
- 
Constructor Details- 
IsIterableWithSizeConstructor, best called fromiterableWithSize(int)oriterableWithSize(Matcher).- Parameters:
- sizeMatcher- checks the expected size of the iterable
 
 
- 
- 
Method Details- 
featureValueOfDescription copied from class:FeatureMatcherImplement this to extract the interesting feature.- Specified by:
- featureValueOfin class- FeatureMatcher<Iterable<E>,- Integer> 
- Parameters:
- actual- the target object
- Returns:
- the feature to be matched
 
- 
iterableWithSizeCreates a matcher forIterables that matches when a single pass over the examinedIterableyields an item count that satisfies the specified matcher. For example:assertThat(Arrays.asList("foo", "bar"), iterableWithSize(equalTo(2)))- Type Parameters:
- E- the matcher type.
- Parameters:
- sizeMatcher- a matcher for the number of items that should be yielded by an examined- Iterable
- Returns:
- The matcher.
 
- 
iterableWithSizeCreates a matcher forIterables that matches when a single pass over the examinedIterableyields an item count that is equal to the specifiedsizeargument. For example:assertThat(Arrays.asList("foo", "bar"), iterableWithSize(2))- Type Parameters:
- E- the matcher type.
- Parameters:
- size- the number of items that should be yielded by an examined- Iterable
- Returns:
- The matcher.
 
 
-