File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/test/java/org/json/junit Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11package org .json .junit ;
22
33import static org .junit .Assert .assertEquals ;
4+ import static org .junit .Assert .assertFalse ;
45import static org .junit .Assert .assertNotEquals ;
56import static org .junit .Assert .assertTrue ;
67
@@ -293,7 +294,19 @@ public void testXmlEscapeToJson(){
293294 compareStringToJSONObject (xmlStr , expectedStr );
294295 compareReaderToJSONObject (xmlStr , expectedStr );
295296 compareFileToJSONObject (xmlStr , expectedStr );
296-
297+ }
298+
299+ /**
300+ * Tests that certain unicode characters are escaped.
301+ */
302+ @ Test
303+ public void testJsonToXmlEscape (){
304+ JSONObject json = new JSONObject ("{ \" amount\" : \" 10,00 €\" , \" description\" : \" Ação Válida\" }" );
305+ String xml = XML .toString (json );
306+ assertFalse ("Escaping € failed. Found in XML output." , xml .contains ("€" ));
307+ assertTrue ("Escaping ç failed. Not found in XML output." , xml .contains ("ç" ));
308+ assertTrue ("Escaping ã failed. Not found in XML output." , xml .contains ("ã" ));
309+ assertTrue ("Escaping á failed. Not found in XML output." , xml .contains ("á" ));
297310 }
298311
299312 /**
You can’t perform that action at this time.
0 commit comments