I have a JUnit test case where text blocks are checked. There is the hard coded "correct" value:
String CORRECT_VAL = "First\\nSecond";
The json is generated like this:
String json =
"{\n" +
" \"val\":\"" + CORRECT_VAL + "\",\n" +
"}";
This String is converted to a JSONObject by org.json. But then the test failed:
expected:<First[\r\n]Second> but was:<First[
]Second>
So I see the "\n" in the console, too. :(
Comment Try 1":
expected:<First\[\]nSecond> but was:<First\[]nSecond>
Expected :First\\nSecond
Actual :First\nSecond
Aucun commentaire:
Enregistrer un commentaire