Package org.hamcrest.text
Class CharSequenceLength
java.lang.Object
- All Implemented Interfaces:
Matcher<CharSequence>,SelfDescribing
- Author:
- Marco Leichsenring, Steve Freeman
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IntegerfeatureValueOf(CharSequence actual) Implement this to extract the interesting feature.static Matcher<CharSequence> hasLength(int length) Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:static Matcher<CharSequence> Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafelyMethods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
CharSequenceLength
- Parameters:
lengthMatcher- The matcher to apply to the feature
-
-
Method Details
-
featureValueOf
Description copied from class:FeatureMatcherImplement this to extract the interesting feature.- Specified by:
featureValueOfin classFeatureMatcher<CharSequence,Integer> - Parameters:
actual- the target object- Returns:
- the feature to be matched
-
hasLength
Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:assertThat("text", hasLength(4))- Parameters:
length- the expected length of the string- Returns:
- The matcher.
-
hasLength
Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:assertThat("text", hasLength(lessThan(4)))- Parameters:
lengthMatcher- the expected length of the string- Returns:
- The matcher.
-