### Question:
Strings { @Contract("null,_->false") public static boolean matches(@Nullable final CharSequence string, @NotNull final Pattern pattern) { if (string == null) return false; return pattern.matcher(string).matches(); }  @SuppressWarnings({"StringEquality", "SimplifiableIfStatement"}) static boolean eq(final String str1, final String str2); @SuppressWarnings({"StringEquality", "SimplifiableIfStatement"}) static boolean eq(final String str1, final String str2, final boolean caseSensitive); @NotNull static String ensureStartsWith(@NotNull final String str, final char c); @NotNull static String ensureEndsWith(@NotNull final String str, final char c); @NotNull static String removeEnding(@NotNull final String str, @NotNull final String ending); @NotNull static String rtrim(@NotNull final String str); @NotNull static String replace(@NotNull final String where, @NotNull final String what, @NotNull final String with); @NotNull static String repeat(@NotNull final String what, @Nullable final String delimiter, int count); @Contract("null,_->false") static boolean matches(@Nullable final CharSequence string, @NotNull final Pattern pattern); @Contract("null,_,_->false") static boolean matches(@Nullable final CharSequence string, @NotNull final String pattern, boolean caseSensitive); @Contract("!null->!null; null->null") static String upper(@Nullable final String string); @Contract("!null->!null; null->null") static String lower(@Nullable final String string); @Contract("!null->!null; null->null") static String minimizeSpaces(@Nullable final String string); @Contract("!null,_->!null; null,_->null") static String lastPart(@Nullable final String string, final char delimiter);  }### Answer:
@Test public void matches_caseSensitivity() { assertThat(matches("ABCDE", "abcde", false)).isTrue(); assertThat(matches("ABCDE", "abcde", true)).isFalse(); }
@Test public void matches_nulls() { assertThat(matches(null, "abcde", false)).isFalse(); assertThat(matches(null, "abcde", true)).isFalse(); assertThat(matches(null, Pattern.compile("abcde"))).isFalse(); }
@Test public void matches_basic() { assertThat(matches("ABCDE", "ABCDE", false)).isTrue(); assertThat(matches("ABCDE", "^ABCDE$", false)).isTrue(); assertThat(matches("ABCDE", ".*BCD.*", false)).isTrue(); assertThat(matches("ABCDE", "^.*BCD.*$", false)).isTrue(); assertThat(matches("ABXDE", "^.*BCD.*$", false)).isFalse(); }