public class IsArrayWithSize<E> extends FeatureMatcher<E[],java.lang.Integer>
| Constructor and Description |
|---|
IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
| Modifier and Type | Method and Description |
|---|---|
static <E> Matcher<E[]> |
arrayWithSize(int size)
Creates a matcher for arrays that matches when the
length of the array
equals the specified size. |
static <E> Matcher<E[]> |
arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
Creates a matcher for arrays that matches when the
length of the array
satisfies the specified matcher. |
static <E> Matcher<E[]> |
emptyArray()
Creates a matcher for arrays that matches when the
length of the array
is zero. |
protected java.lang.Integer |
featureValueOf(E[] actual)
Implement this to extract the interesting feature.
|
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic IsArrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(E[] actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<E[],java.lang.Integer>actual - the target objectpublic static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
length of the array
satisfies the specified matcher.
For example:
assertThat(new String[]{"foo", "bar"}, arrayWithSize(equalTo(2)))sizeMatcher - a matcher for the length of an examined arraypublic static <E> Matcher<E[]> arrayWithSize(int size)
length of the array
equals the specified size.
For example:
assertThat(new String[]{"foo", "bar"}, arrayWithSize(2))size - the length that an examined array must have for a positive matchpublic static <E> Matcher<E[]> emptyArray()
length of the array
is zero.
For example:
assertThat(new String[0], emptyArray())