mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
New tests for XML unescaping
This commit is contained in:
parent
d0e2cf41a3
commit
cb61bbf720
@ -765,4 +765,28 @@ public class XMLTest {
|
||||
assertEquals(expectedReverseXml, reverseXml);
|
||||
}
|
||||
|
||||
/**
|
||||
* test to validate certain conditions of XML unescaping.
|
||||
*/
|
||||
@Test
|
||||
public void testUnescape() {
|
||||
assertEquals("{\"xml\":\"Can cope <;\"}",
|
||||
XML.toJSONObject("<xml>Can cope <; </xml>").toString());
|
||||
assertEquals("Can cope <; ", XML.unescape("Can cope <; "));
|
||||
|
||||
assertEquals("{\"xml\":\"Can cope & ;\"}",
|
||||
XML.toJSONObject("<xml>Can cope & ; </xml>").toString());
|
||||
assertEquals("Can cope & ; ", XML.unescape("Can cope & ; "));
|
||||
|
||||
assertEquals("{\"xml\":\"Can cope &;\"}",
|
||||
XML.toJSONObject("<xml>Can cope &; </xml>").toString());
|
||||
assertEquals("Can cope &; ", XML.unescape("Can cope &; "));
|
||||
|
||||
// double escaped
|
||||
assertEquals("{\"xml\":\"Can cope <\"}",
|
||||
XML.toJSONObject("<xml>Can cope &lt; </xml>").toString());
|
||||
assertEquals("Can cope < ", XML.unescape("Can cope &lt; "));
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user