FormatUtils { public static boolean isWildCardMatch(String text, String pattern, boolean ignoreCase) { boolean match = isWildCardMatch(text, pattern); if (ignoreCase && !match) { match = isWildCardMatch(text.toLowerCase(), pattern); if (!match) { match = isWildCardMatch(text.toUpperCase(), pattern); } } return match; } private  FormatUtils(); static String replace(String prop, String replaceWith, String sourceString); static String replaceToken(String text, String tokenToReplace, String replaceWithText,
            boolean matchUsingPrefixSuffix); static String replaceTokens(String text, Map<String, String> replacements,
            boolean matchUsingPrefixSuffix); static String formatString(String format, String arg); static boolean toBoolean(String value); static boolean isMixedCase(String text); static boolean isWildCardMatch(String text, String pattern, boolean ignoreCase); static boolean isWildCardMatch(String text, String pattern); static String unescapeWildCards(String str); static String escapeWildCards(String str); static boolean isWildCarded(String str); static String[] wordWrap(String str, int firstLineSize, int nonFirstLineSize); static String[] wordWrap(String str, int lineSize); static String abbreviateForLogging(String value); @SuppressWarnings("rawtypes") static String abbreviateForLogging(List list, int maxCharsToLog); static Date parseDate(String str, String[] parsePatterns); static Date parseDate(String str, String[] parsePatterns, TimeZone timeZone); static Timestamp parseTimestampWithTimezone(String str); static Timestamp parseTimestampWithTimezone(String str, String[] parsePatterns); static String[] splitOnSpacePreserveQuotedStrings(String source); static String replaceCharsToShortenName(String name); static String lower(String str); static String upper(String str); static boolean isInfamousTurkey(); static String stripTurkeyDottedI(String str); static String formatDurationReadable(long duration); static String formatDateTimeISO(Date date); static boolean isInteger(String s); static final String[] TIMESTAMP_PATTERNS; static final String[] TIME_PATTERNS; static final String[] TIMESTAMP_WITH_TIMEZONE_PATTERNS; static final FastDateFormat TIMESTAMP_FORMATTER; static final FastDateFormat TIME_FORMATTER; final static String WILDCARD; final static String WILDCARD_SEPARATOR; final static String NEGATE_TOKEN; final static char WILDCARD_SEPARATOR_CHAR; final static char WILDCARD_CHAR; final static char NEGATE_TOKEN_CHAR; final static String WILDCARD_ESCAPED; final static String WILDCARD_SEPARATOR_ESCAPED; final static String NEGATE_TOKEN_ESCAPED; final static int MAX_CHARS_TO_LOG; }
@Test public void testIsWildcardMatch() { assertTrue(FormatUtils.isWildCardMatch("TEST_1", "TEST_*")); assertTrue(FormatUtils.isWildCardMatch("TEST_2", "TEST_*")); assertTrue(FormatUtils.isWildCardMatch("TEST_TEST_TEST", "TEST_*")); assertFalse(FormatUtils.isWildCardMatch("NOT_A_MATCH", "TEST_*")); assertFalse(FormatUtils.isWildCardMatch("NOT_A_MATCH_TEST_1", "TEST_*")); assertTrue(FormatUtils.isWildCardMatch("NOT_A_MATCH_TEST_1", "*TEST*")); assertFalse(FormatUtils.isWildCardMatch("TEST_12", "TEST_1")); assertFalse(FormatUtils.isWildCardMatch("B_A", "*A*B")); assertTrue(FormatUtils.isWildCardMatch("A_B", "*A*B")); assertFalse(FormatUtils.isWildCardMatch("TEST_NO_MATCH", "TEST_*,!TEST_NO_MATCH")); assertTrue(FormatUtils.isWildCardMatch("A_B", "A*B")); }