StringParameterValue extends AbstractParameterValue { @Override public String getQueryString() { return "\"" + getEscapedValue() + "\"" + (language != null ? ("@" + language) : ""); } StringParameterValue(String value);   StringParameterValue(String value, String language); @Override String getValue(); String getLanguage(); @Override String getQueryString();  }
@Test public void getQueryStringEscapesNewlinesInQueryParameter() { final String value = "fdjsakfsa;f\n fdjsajsfd"; final String expected = "\"fdjsakfsa;f\\n fdjsajsfd\""; final StringParameterValue sut = new StringParameterValue(value); assertEquals(expected, sut.getQueryString()); }
@Test public void getQueryStringEscapesEscapeSequencesInValue() { final String value = "aaa\nbbb\tccc\bdddd\reee\feee\'fff\'ggg\"hhh\"iii\\jjj"; final String expected = "\"aaa\\nbbb\\tccc\\bdddd\\reee\\feee\\'fff\\'ggg\\\"hhh\\\"iii\\\\jjj\""; final StringParameterValue sut = new StringParameterValue(value); assertEquals(expected, sut.getQueryString()); }