mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
New tests for XML unescaping
This commit is contained in:
parent
d0e2cf41a3
commit
cb61bbf720
1 changed files with 24 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue