I have a class that implements Route interface (package spark) that is supposed to return a String in the handle
function. When I convert the response to String I have two extra "
in the beginning and the end of my String and the \n
is not recognized as 1 char in my String but rather as 2. Does anyone know the fix?
This is the code and response
is an instance of HttpResponse
:
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
String output = EntityUtils.toString(response.getEntity())
The next Assertion fails
Assert.assertEquals(10, output.length());
Java.lang.AssertionError:
Expected :10
Actual :13
And according to System.out
output is
"123456789\n"
While it should be 123456789
and a \n
at the end of it but I don't believe \n
should be shown in System.out.print()