### Question:
SearchUtils { public static String toSqlWildcardString(String value, boolean alwaysWildcard) { if (value.contains("\\")) { value = value.replaceAll("\\\\", "\\\\\\\\"); } if (value.contains("_") && escapeUnderscoreChar()) { value = value.replaceAll("_", "\\\\_"); } if (value.contains("%")) { value = value.replaceAll("%", "\\\\%"); } if (!containsWildcard(value)) { return alwaysWildcard ? "%" + value + "%" : value; } value = value.replaceAll("\\*", "%"); return value; } private  SearchUtils(); static SimpleDateFormat getContextualDateFormat(); static SimpleDateFormat getContextualDateFormatOrDefault(final String pattern); static Date dateFromStringWithContextProperties(String value); static SimpleDateFormat getDateFormat(Map<String, String> properties); static SimpleDateFormat getDateFormat(String dfProperty); static boolean isTimeZoneSupported(Map<String, String> properties, Boolean defaultValue); static String toSQL(SearchCondition<T> sc, String table, String... columns); static String toSqlWildcardString(String value, boolean alwaysWildcard); static String duplicateSingleQuoteIfNeeded(String value); static boolean containsEscapedChar(String value); static boolean containsWildcard(String value); static boolean containsEscapedPercent(String value); static void startSqlQuery(StringBuilder sb,
                                     String table,
                                     String tableAlias,
                                     List<String> columns); static String conditionTypeToSqlOperator(ConditionType ct, String value, String originalValue); static Date dateFromStringWithDefaultFormats(String value); static final String TIMESTAMP_NO_TIMEZONE; static final String TIMESTAMP_WITH_TIMEZONE_Z; static final String DEFAULT_DATE_FORMAT; static final String DATE_FORMAT_PROPERTY; static final String TIMEZONE_SUPPORT_PROPERTY; static final String LAX_PROPERTY_MATCH; static final String BEAN_PROPERTY_MAP; static final String BEAN_PROPERTY_CONVERTER; static final String SEARCH_VISITOR_PROPERTY; static final String DECODE_QUERY_VALUES; static final String ESCAPE_UNDERSCORE_CHAR; }### Answer:
@Test public void testSqlWildcardString() { assertEquals("abc", SearchUtils.toSqlWildcardString("abc", false)); }
@Test public void testSqlWildcardStringAlways() { assertEquals("%abc%", SearchUtils.toSqlWildcardString("abc", true)); }
@Test public void testSqlWildcardString2() { assertEquals("%abc", SearchUtils.toSqlWildcardString("*abc", false)); }
@Test public void testSqlWildcardString3() { assertEquals("abc%", SearchUtils.toSqlWildcardString("abc*", false)); }
@Test public void testSqlWildcardString4() { assertEquals("%abc%", SearchUtils.toSqlWildcardString("*abc*", false)); }
@Test public void testSqlWildcardString5() { assertEquals("%", SearchUtils.toSqlWildcardString("*", false)); }