SolrLocalParamFormatter implements Printer<String>, Parser<String> { @Override public String parse(String str, Locale locale) throws ParseException { return str.replace("{!", "\\{\\!").replace("}", "\\}"); }  @Override String print(String str, Locale locale); @Override String parse(String str, Locale locale);  }
@Test public void shouldEscapeInputString() throws ParseException { String input = "{! field=test}"; String expected = "\\{\\! field=test\\}"; assertEquals(expected, formatter.parse(input, Locale.getDefault())); }