public class IsCollectionWithSize<E> extends FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
| Constructor and Description |
|---|
IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Integer |
featureValueOf(java.util.Collection<? extends E> actual)
Implement this to extract the interesting feature.
|
static <E> Matcher<java.util.Collection<? extends E>> |
hasSize(int size)
Creates a matcher for
Collections that matches when the size() method returns
a value equal to the specified size. |
static <E> Matcher<java.util.Collection<? extends E>> |
hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
Creates a matcher for
Collections that matches when the size() method returns
a value that satisfies the specified matcher. |
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic IsCollectionWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>actual - the target objectpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> sizeMatcher)
Collections that matches when the size() method returns
a value that satisfies the specified matcher.
For example:
assertThat(Arrays.asList("foo", "bar"), hasSize(equalTo(2)))sizeMatcher - a matcher for the size of an examined Collectionpublic static <E> Matcher<java.util.Collection<? extends E>> hasSize(int size)
Collections that matches when the size() method returns
a value equal to the specified size.
For example:
assertThat(Arrays.asList("foo", "bar"), hasSize(2))size - the expected size of an examined Collection