KeywordsUtil { public static String escape(String text) { for (int i = SPECIAL.length - 1; i >= 0; i--) { text = StringUtil.replace( text, SPECIAL[i], StringPool.BACK_SLASH + SPECIAL[i]); } return text; }  static String escape(String text); static String toFuzzy(String keywords); static String toWildcard(String keywords); static final String[] SPECIAL; }
@Test public void testEscapeEspecial() { Assert.assertEquals( "\\{abc \\&& def\\}", KeywordsUtil.escape("{abc && def}")); }
@Test public void testEscapeMultipleBracket() { Assert.assertEquals("abc\\{", KeywordsUtil.escape("abc{")); }
@Test public void testEscapeNoEspecialCharacters() { Assert.assertEquals("abc", KeywordsUtil.escape("abc")); }