public class CharSequenceLength extends FeatureMatcher<CharSequence,Integer>
| Constructor and Description |
|---|
CharSequenceLength(Matcher<? super Integer> lengthMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected Integer |
featureValueOf(CharSequence actual)
Implement this to extract the interesting feature.
|
static Matcher<CharSequence> |
hasLength(int length)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
static Matcher<CharSequence> |
hasLength(Matcher<? super Integer> lengthMatcher)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringprotected Integer featureValueOf(CharSequence actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<CharSequence,Integer>actual - the target objectpublic static Matcher<CharSequence> hasLength(int length)
CharSequence that matches when a char sequence has the given length
For example:
assertThat("text", hasLength(4))
length - the expected length of the stringpublic static Matcher<CharSequence> hasLength(Matcher<? super Integer> lengthMatcher)
CharSequence that matches when a char sequence has the given length
For example:
assertThat("text", hasLength(lessThan(4)))
lengthMatcher - the expected length of the stringCopyright © 2021. All rights reserved.