diff --git a/XMLTest.java b/XMLTest.java
index 87d956e..3f57710 100644
--- a/XMLTest.java
+++ b/XMLTest.java
@@ -28,15 +28,30 @@ public class XMLTest {
String xmlStr = XML.toString(jsonObject);
}
- @Test
- public void shouldHandleInvalidCDATA() {
+ @Test(expected=JSONException.class)
+ public void shouldHandleInvalidBangInTag() {
String xmlStr =
"\n"+
"\n"+
" \n"+
" Joe Tester\n"+
- " ![Baker street 5\n"+
+ " abc street\n"+
+ " \n"+
+ "";
+ JSONObject jsonObject = XML.toJSONObject(xmlStr);
+ assertTrue(jsonObject == null);
+ }
+
+ @Test(expected=JSONException.class)
+ public void shouldHandleInvalidSlashInTag() {
+ String xmlStr =
+ "\n"+
+ "\n"+
+ " \n"+
+ " \n"+
+ " abc street\n"+
" \n"+
"";
JSONObject jsonObject = XML.toJSONObject(xmlStr);
@@ -66,12 +81,13 @@ public class XMLTest {
"
\n"+
" Joe Tester\n"+
" [CDATA[Baker street 5]\n"+
+ " \n"+
" \n"+
"";
String expectedStr =
"{\"addresses\":{\"address\":{\"street\":\"[CDATA[Baker street 5]\","+
- "\"name\":\"Joe Tester\"},\"xsi:noNamespaceSchemaLocation\":"+
+ "\"name\":\"Joe Tester\",\"NothingHere\":\"\"},\"xsi:noNamespaceSchemaLocation\":"+
"\"test.xsd\",\"xmlns:xsi\":\"http://www.w3.org/2001/"+
"XMLSchema-instance\"}}";