@Test public void escapeUnderscoreCharacter() { final String input = "TST-1_1"; assertThat(SearchUtil.replaceWildcards(input)).isEqualTo("TST-1\\_1"); }
public static String replaceWildcards(final String input) { if (input == null) { return null; } else { return input.replace(ESCAPE, ESCAPE + ESCAPE) .replace(WILDCARD_ALL_REPLACEMENT, ESCAPE + WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE_REPLACEMENT, ESCAPE + WILDCARD_SINGLE_REPLACEMENT) .replace(WILDCARD_ALL, WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE, WILDCARD_SINGLE_REPLACEMENT); } }
SearchUtil { public static String replaceWildcards(final String input) { if (input == null) { return null; } else { return input.replace(ESCAPE, ESCAPE + ESCAPE) .replace(WILDCARD_ALL_REPLACEMENT, ESCAPE + WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE_REPLACEMENT, ESCAPE + WILDCARD_SINGLE_REPLACEMENT) .replace(WILDCARD_ALL, WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE, WILDCARD_SINGLE_REPLACEMENT); } } }
SearchUtil { public static String replaceWildcards(final String input) { if (input == null) { return null; } else { return input.replace(ESCAPE, ESCAPE + ESCAPE) .replace(WILDCARD_ALL_REPLACEMENT, ESCAPE + WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE_REPLACEMENT, ESCAPE + WILDCARD_SINGLE_REPLACEMENT) .replace(WILDCARD_ALL, WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE, WILDCARD_SINGLE_REPLACEMENT); } } private  SearchUtil(); }
SearchUtil { public static String replaceWildcards(final String input) { if (input == null) { return null; } else { return input.replace(ESCAPE, ESCAPE + ESCAPE) .replace(WILDCARD_ALL_REPLACEMENT, ESCAPE + WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE_REPLACEMENT, ESCAPE + WILDCARD_SINGLE_REPLACEMENT) .replace(WILDCARD_ALL, WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE, WILDCARD_SINGLE_REPLACEMENT); } } private  SearchUtil(); static String replaceWildcards(final String input); }
SearchUtil { public static String replaceWildcards(final String input) { if (input == null) { return null; } else { return input.replace(ESCAPE, ESCAPE + ESCAPE) .replace(WILDCARD_ALL_REPLACEMENT, ESCAPE + WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE_REPLACEMENT, ESCAPE + WILDCARD_SINGLE_REPLACEMENT) .replace(WILDCARD_ALL, WILDCARD_ALL_REPLACEMENT) .replace(WILDCARD_SINGLE, WILDCARD_SINGLE_REPLACEMENT); } } private  SearchUtil(); static String replaceWildcards(final String input);  }