@@ -41,7 +41,7 @@ of this software and associated documentation files (the "Software"), to deal
4141 *
4242 * @author JSON.org
4343 * @author yusuke at mac.com
44- * @version 2010-12-29
44+ * @version 2011-01-13
4545 */
4646public class Test extends TestCase {
4747 public Test (String name ) {
@@ -350,8 +350,8 @@ public void testJSON() throws Exception {
350350 "}}" , jsonobject .toString (4 ));
351351
352352 jsonobject = new JSONObject (beanie );
353- // assertEquals("{\"string\":\"A beany object\",\"BENT\":\"All uppercase key\",\"boolean\":true,\"number\":42,\"x\":\"x\"}"
354- // , jsonobject.toString());
353+ assertEquals ("{\" string\" :\" A beany object\" ,\" BENT\" :\" All uppercase key\" ,\" boolean\" :true,\" number\" :42,\" x\" :\" x\" }"
354+ , jsonobject .toString ());
355355
356356 string = "{ \" entity\" : { \" imageURL\" : \" \" , \" name\" : \" IXXXXXXXXXXXXX\" , \" id\" : 12336, \" ratingCount\" : null, \" averageRating\" : null } }" ;
357357 jsonobject = new JSONObject (string );
@@ -491,7 +491,7 @@ public void testJSON() throws Exception {
491491 " ],\n " +
492492 " \" slashes\" : \" ///\" \n " +
493493 "}" , jsonobject .toString (2 ));
494- assertEquals ("<quotes>' </quotes><quotes>"</quotes><slashes>///</slashes><ei><quotes>"' </quotes></ei><eo><b>don' t</b><a>"quoted"</a></eo><closetag></script></closetag><backslash>\\ </backslash>" ,
494+ assertEquals ("<quotes>' </quotes><quotes>"</quotes><slashes>///</slashes><ei><quotes>"' </quotes></ei><eo><b>don' t</b><a>"quoted"</a></eo><closetag></script></closetag><backslash>\\ </backslash>" ,
495495 XML .toString (jsonobject ));
496496
497497 jsonobject = new JSONObject (
@@ -520,7 +520,7 @@ public void testJSON() throws Exception {
520520 jsonarray .put (false );
521521 jsonarray .put (new JSONArray ());
522522 jsonarray .put (new JSONObject ());
523- jsonobject .put ("keys" , JSONObject .getNames (jsonobject ));
523+ jsonobject .put ("keys" , JSONObject .getNames (jsonobject ));
524524 assertEquals ("{\n " +
525525 " \" JSONArray\" : [],\n " +
526526 " \" JSONObject\" : {},\n " +
@@ -581,8 +581,8 @@ public void testJSON() throws Exception {
581581 " \" true\" : true,\n " +
582582 " \" zero\" : -0\n " +
583583 "}" , jsonobject .toString (4 ));
584- // assertEquals("<to>null</to><ten>10</ten><JSONObject></JSONObject><op>Good</op><keys>[Ljava.lang. String;@4d125127 </keys><int>57</int><true>true</true><foo>true</foo><foo>false</foo><foo>9876543210</foo><foo>0.0</foo><foo>1.00000001</foo><foo>1.000000000001</foo><foo>1.0</foo><foo>1.0E-17</foo><foo>2.0</foo><foo>0.1</foo><foo>2.0E100</foo><foo>-32</foo><foo></foo><foo></foo><foo>string</foo><foo>666</foo><foo>2001.99</foo><foo>so "fine".</foo><foo>so <fine>.</foo><foo>true</foo><foo>false</foo><foo></foo><foo></foo><zero>-0.0</zero><double>1.2345678901234568E29</double><String>98.6</String><false>false</false><bool>true</bool><\\u2028>? </\\u2028><\\u2029>? </\\u2029><null>null</null>",
585- // XML.toString(j ));
584+ assertEquals ("<to>null</to><ten>10</ten><JSONObject></JSONObject><op>Good</op><keys>to</keys><keys>ten</keys><keys>JSONObject</keys><keys>JSONArray</keys><keys>op</keys><keys>int</keys><keys>true</keys><keys>foo</keys><keys>zero</keys><keys>double</keys><keys> String</keys><keys>false</keys><keys>bool</keys><keys> \\ u2028</keys><keys> \\ u2029</keys><keys>null</keys>< int>57</int><true>true</true><foo>true</foo><foo>false</foo><foo>9876543210</foo><foo>0.0</foo><foo>1.00000001</foo><foo>1.000000000001</foo><foo>1.0</foo><foo>1.0E-17</foo><foo>2.0</foo><foo>0.1</foo><foo>2.0E100</foo><foo>-32</foo><foo></foo><foo></foo><foo>string</foo><foo>666</foo><foo>2001.99</foo><foo>so "fine".</foo><foo>so <fine>.</foo><foo>true</foo><foo>false</foo><foo></foo><foo></foo><zero>-0.0</zero><double>1.2345678901234568E29</double><String>98.6</String><false>false</false><bool>true</bool><\\ u2028>\u2028 </\\ u2028><\\ u2029>\u2029 </\\ u2029><null>null</null>" ,
585+ XML .toString (jsonobject ));
586586 assertEquals (98.6d , jsonobject .getDouble ("String" ), eps );
587587 assertTrue (jsonobject .getBoolean ("bool" ));
588588 assertEquals (null , jsonobject .getString ("to" ));
@@ -1057,7 +1057,7 @@ public void testJSON() throws Exception {
10571057 " \" xmlns:xsi\" : \" http://www.w3.org/1999/XMLSchema-instance\" \n " +
10581058 "}}" , jsonobject .toString (2 ));
10591059
1060- assertEquals ("<SOAP-ENV:Envelope><SOAP-ENV:Body><ns1:doGoogleSearch><oe>latin1<xsi:type>xsd:string</xsi:type></oe><SOAP-ENV:encodingStyle>http://schemas.xmlsoap.org/soap/encoding/</SOAP-ENV:encodingStyle><lr><xsi:type>xsd:string</xsi:type></lr><start>0<xsi:type>xsd:int</xsi:type></start><q>' +search+' <xsi:type>xsd:string</xsi:type></q><ie>latin1<xsi:type>xsd:string</xsi:type></ie><safeSearch>false<xsi:type>xsd:boolean</xsi:type></safeSearch><xmlns:ns1>urn:GoogleSearch</xmlns:ns1><restrict><xsi:type>xsd:string</xsi:type></restrict><filter>true<xsi:type>xsd:boolean</xsi:type></filter><maxResults>10<xsi:type>xsd:int</xsi:type></maxResults><key>GOOGLEKEY<xsi:type>xsd:string</xsi:type></key></ns1:doGoogleSearch></SOAP-ENV:Body><xmlns:xsd>http://www.w3.org/1999/XMLSchema</xmlns:xsd><xmlns:xsi>http://www.w3.org/1999/XMLSchema-instance</xmlns:xsi><xmlns:SOAP-ENV>http://schemas.xmlsoap.org/soap/envelope/</xmlns:SOAP-ENV></SOAP-ENV:Envelope>" ,
1060+ assertEquals ("<SOAP-ENV:Envelope><SOAP-ENV:Body><ns1:doGoogleSearch><oe>latin1<xsi:type>xsd:string</xsi:type></oe><SOAP-ENV:encodingStyle>http://schemas.xmlsoap.org/soap/encoding/</SOAP-ENV:encodingStyle><lr><xsi:type>xsd:string</xsi:type></lr><start>0<xsi:type>xsd:int</xsi:type></start><q>' +search+' <xsi:type>xsd:string</xsi:type></q><ie>latin1<xsi:type>xsd:string</xsi:type></ie><safeSearch>false<xsi:type>xsd:boolean</xsi:type></safeSearch><xmlns:ns1>urn:GoogleSearch</xmlns:ns1><restrict><xsi:type>xsd:string</xsi:type></restrict><filter>true<xsi:type>xsd:boolean</xsi:type></filter><maxResults>10<xsi:type>xsd:int</xsi:type></maxResults><key>GOOGLEKEY<xsi:type>xsd:string</xsi:type></key></ns1:doGoogleSearch></SOAP-ENV:Body><xmlns:xsd>http://www.w3.org/1999/XMLSchema</xmlns:xsd><xmlns:xsi>http://www.w3.org/1999/XMLSchema-instance</xmlns:xsi><xmlns:SOAP-ENV>http://schemas.xmlsoap.org/soap/envelope/</xmlns:SOAP-ENV></SOAP-ENV:Envelope>" ,
10611061 XML .toString (jsonobject ));
10621062
10631063 jsonobject = new JSONObject ("{Envelope: {Body: {\" ns1:doGoogleSearch\" : {oe: \" latin1\" , filter: true, q: \" '+search+'\" , key: \" GOOGLEKEY\" , maxResults: 10, \" SOAP-ENV:encodingStyle\" : \" http://schemas.xmlsoap.org/soap/encoding/\" , start: 0, ie: \" latin1\" , safeSearch:false, \" xmlns:ns1\" : \" urn:GoogleSearch\" }}}}" );
@@ -1073,7 +1073,7 @@ public void testJSON() throws Exception {
10731073 " \" start\" : 0,\n " +
10741074 " \" xmlns:ns1\" : \" urn:GoogleSearch\" \n " +
10751075 "}}}}" , jsonobject .toString (2 ));
1076- assertEquals ("<Envelope><Body><ns1:doGoogleSearch><oe>latin1</oe><SOAP-ENV:encodingStyle>http://schemas.xmlsoap.org/soap/encoding/</SOAP-ENV:encodingStyle><start>0</start><q>' +search+' </q><ie>latin1</ie><safeSearch>false</safeSearch><xmlns:ns1>urn:GoogleSearch</xmlns:ns1><maxResults>10</maxResults><key>GOOGLEKEY</key><filter>true</filter></ns1:doGoogleSearch></Body></Envelope>" ,
1076+ assertEquals ("<Envelope><Body><ns1:doGoogleSearch><oe>latin1</oe><SOAP-ENV:encodingStyle>http://schemas.xmlsoap.org/soap/encoding/</SOAP-ENV:encodingStyle><start>0</start><q>' +search+' </q><ie>latin1</ie><safeSearch>false</safeSearch><xmlns:ns1>urn:GoogleSearch</xmlns:ns1><maxResults>10</maxResults><key>GOOGLEKEY</key><filter>true</filter></ns1:doGoogleSearch></Body></Envelope>" ,
10771077 XML .toString (jsonobject ));
10781078
10791079 jsonobject = CookieList .toJSONObject (" f%oo = b+l=ah ; o;n%40e = t.wo " );
0 commit comments