public class CharSequenceLength extends FeatureMatcher<java.lang.CharSequence,java.lang.Integer>
| Constructor and Description |
|---|
CharSequenceLength(Matcher<? super java.lang.Integer> lengthMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Integer |
featureValueOf(java.lang.CharSequence actual)
Implement this to extract the interesting feature.
|
static Matcher<java.lang.CharSequence> |
hasLength(int length)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
static Matcher<java.lang.CharSequence> |
hasLength(Matcher<? super java.lang.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, toStringpublic CharSequenceLength(Matcher<? super java.lang.Integer> lengthMatcher)
lengthMatcher - The matcher to apply to the featureprotected java.lang.Integer featureValueOf(java.lang.CharSequence actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.lang.CharSequence,java.lang.Integer>actual - the target objectpublic static Matcher<java.lang.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<java.lang.CharSequence> hasLength(Matcher<? super java.lang.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 string