### Question:
StringUtils { public static boolean containsPattern(final String string, final String pattern) { return containsPattern(string, Pattern.compile(pattern)); }  static String replaceSubstring(final String s, final int startIndex, final int endIndex,
            final String replacement); static List<E> parseListEnums(final String s, final Class<E> enumClass); static E parseEnum(final String s, final Class<E> enumClass); static E fromValue(final Class<E> enumClass, final String value); static String join(final List<String> substrings, final String join); static String join(final List<String> substrings); static boolean containsPattern(final String string, final String pattern); static boolean containsPattern(final String string, final Pattern pattern);  }### Answer:
@Test public void shouldContainPattern_withStringAndRegex() { final String string = "abcXYZdef"; final String regex = "X?Z"; final boolean containsPattern = StringUtils.containsPattern(string, regex); assertTrue(containsPattern); }
@Test public void shouldContainPattern_withStringAndPattern() { final String string = "abcXYZdef"; final Pattern pattern = Pattern.compile("[A-Z]{3}"); final boolean containsPattern = StringUtils.containsPattern(string, pattern); assertTrue(containsPattern); }