/** * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length * For example: * * <pre> * assertThat("text", hasLength(lessThan(4))) * </pre> * * @param lengthMatcher the expected length of the string */ @SuppressWarnings("WeakerAccess") public static Matcher<CharSequence> hasLength(Matcher<? super Integer> lengthMatcher) { return new CharSequenceLength(lengthMatcher); } }
/** * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length * For example: * * <pre> * assertThat("text", hasLength(4)) * </pre> * * @param length the expected length of the string */ public static Matcher<CharSequence> hasLength(int length) { return new CharSequenceLength(equalTo(length)); }
/** * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length * For example: * * <pre> * assertThat("text", hasLength(lessThan(4))) * </pre> * * @param lengthMatcher the expected length of the string */ @SuppressWarnings("WeakerAccess") public static Matcher<CharSequence> hasLength(Matcher<? super Integer> lengthMatcher) { return new CharSequenceLength(lengthMatcher); } }
/** * Creates a matcher of {@link CharSequence} that matches when a char sequence has the given length * For example: * * <pre> * assertThat("text", hasLength(4)) * </pre> * * @param length the expected length of the string */ public static Matcher<CharSequence> hasLength(int length) { return new CharSequenceLength(equalTo(length)); }