@@ -40,7 +40,7 @@ of this software and associated documentation files (the "Software"), to deal
4040 * comparisons of .toString to a string literal are likely to fail.
4141 *
4242 * @author JSON.org
43- * @version 2011-05-22
43+ * @version 2011-10-03
4444 */
4545public class Test extends TestCase {
4646 public Test (String name ) {
@@ -91,7 +91,11 @@ public void testJSON() throws Exception {
9191
9292 Beany beanie = new Beany ("A beany object" , 42 , true );
9393
94- string = "[0.1]" ;
94+ string = "[001122334455]" ;
95+ jsonarray = new JSONArray (string );
96+ assertEquals ("[1122334455]" , jsonarray .toString ());
97+
98+ string = "[00.10]" ;
9599 jsonarray = new JSONArray (string );
96100 assertEquals ("[0.1]" , jsonarray .toString ());
97101
@@ -154,16 +158,17 @@ public void testJSON() throws Exception {
154158 jsonarray .toString (4 ));
155159 assertEquals ("<div id=\" demo\" class=\" JSONML\" ><p>JSONML is a transformation between<b>JSON</b>and<b>XML</b>that preserves ordering of document features.</p><p>JSONML can work with JSON arrays or JSON objects.</p><p>Three<br/>little<br/>words</p></div>" ,
156160 JSONML .toString (jsonarray ));
161+
162+ string = "{\" xmlns:soap\" :\" http://www.w3.org/2003/05/soap-envelope\" ,\" tagName\" :\" soap:Envelope\" ,\" childNodes\" :[{\" tagName\" :\" soap:Header\" },{\" tagName\" :\" soap:Body\" ,\" childNodes\" :[{\" tagName\" :\" ws:listProducts\" ,\" childNodes\" :[{\" tagName\" :\" ws:delay\" ,\" childNodes\" :[1]}]}]}],\" xmlns:ws\" :\" http://warehouse.acme.com/ws\" }" ;
163+ jsonobject = new JSONObject (string );
164+ assertEquals ("<soap:Envelope xmlns:soap=\" http://www.w3.org/2003/05/soap-envelope\" xmlns:ws=\" http://warehouse.acme.com/ws\" ><soap:Header/><soap:Body><ws:listProducts><ws:delay>1</ws:delay></ws:listProducts></soap:Body></soap:Envelope>" ,
165+ JSONML .toString (jsonobject ));
157166
158167 string = "<person created=\" 2006-11-11T19:23\" modified=\" 2006-12-31T23:59\" >\n <firstName>Robert</firstName>\n <lastName>Smith</lastName>\n <address type=\" home\" >\n <street>12345 Sixth Ave</street>\n <city>Anytown</city>\n <state>CA</state>\n <postalCode>98765-4321</postalCode>\n </address>\n </person>" ;
159168 jsonobject = XML .toJSONObject (string );
160169 assertEquals ("{\" person\" : {\n \" lastName\" : \" Smith\" ,\n \" address\" : {\n \" postalCode\" : \" 98765-4321\" ,\n \" street\" : \" 12345 Sixth Ave\" ,\n \" state\" : \" CA\" ,\n \" type\" : \" home\" ,\n \" city\" : \" Anytown\" \n },\n \" created\" : \" 2006-11-11T19:23\" ,\n \" firstName\" : \" Robert\" ,\n \" modified\" : \" 2006-12-31T23:59\" \n }}" ,
161170 jsonobject .toString (4 ));
162171
163- jsonobject = new JSONObject (beanie );
164- assertEquals ("{\" string\" :\" A beany object\" ,\" BENT\" :\" All uppercase key\" ,\" boolean\" :true,\" number\" :42,\" x\" :\" x\" }"
165- , jsonobject .toString ());
166-
167172 string = "{ \" entity\" : { \" imageURL\" : \" \" , \" name\" : \" IXXXXXXXXXXXXX\" , \" id\" : 12336, \" ratingCount\" : null, \" averageRating\" : null } }" ;
168173 jsonobject = new JSONObject (string );
169174 assertEquals ("{\" entity\" : {\n \" id\" : 12336,\n \" averageRating\" : null,\n \" ratingCount\" : null,\n \" name\" : \" IXXXXXXXXXXXXX\" ,\n \" imageURL\" : \" \" \n }}" ,
0 commit comments