@@ -41,7 +41,7 @@ of this software and associated documentation files (the "Software"), to deal
41
41
*
42
42
* @author JSON.org
43
43
* @author yusuke at mac.com
44
- * @version 2010-12-29
44
+ * @version 2011-01-13
45
45
*/
46
46
public class Test extends TestCase {
47
47
public Test (String name ) {
@@ -350,8 +350,8 @@ public void testJSON() throws Exception {
350
350
"}}" , jsonobject .toString (4 ));
351
351
352
352
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 ());
355
355
356
356
string = "{ \" entity\" : { \" imageURL\" : \" \" , \" name\" : \" IXXXXXXXXXXXXX\" , \" id\" : 12336, \" ratingCount\" : null, \" averageRating\" : null } }" ;
357
357
jsonobject = new JSONObject (string );
@@ -491,7 +491,7 @@ public void testJSON() throws Exception {
491
491
" ],\n " +
492
492
" \" slashes\" : \" ///\" \n " +
493
493
"}" , 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>" ,
495
495
XML .toString (jsonobject ));
496
496
497
497
jsonobject = new JSONObject (
@@ -520,7 +520,7 @@ public void testJSON() throws Exception {
520
520
jsonarray .put (false );
521
521
jsonarray .put (new JSONArray ());
522
522
jsonarray .put (new JSONObject ());
523
- jsonobject .put ("keys" , JSONObject .getNames (jsonobject ));
523
+ jsonobject .put ("keys" , JSONObject .getNames (jsonobject ));
524
524
assertEquals ("{\n " +
525
525
" \" JSONArray\" : [],\n " +
526
526
" \" JSONObject\" : {},\n " +
@@ -581,8 +581,8 @@ public void testJSON() throws Exception {
581
581
" \" true\" : true,\n " +
582
582
" \" zero\" : -0\n " +
583
583
"}" , 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 ));
586
586
assertEquals (98.6d , jsonobject .getDouble ("String" ), eps );
587
587
assertTrue (jsonobject .getBoolean ("bool" ));
588
588
assertEquals (null , jsonobject .getString ("to" ));
@@ -1057,7 +1057,7 @@ public void testJSON() throws Exception {
1057
1057
" \" xmlns:xsi\" : \" http://www.w3.org/1999/XMLSchema-instance\" \n " +
1058
1058
"}}" , jsonobject .toString (2 ));
1059
1059
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>" ,
1061
1061
XML .toString (jsonobject ));
1062
1062
1063
1063
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 {
1073
1073
" \" start\" : 0,\n " +
1074
1074
" \" xmlns:ns1\" : \" urn:GoogleSearch\" \n " +
1075
1075
"}}}}" , 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>" ,
1077
1077
XML .toString (jsonobject ));
1078
1078
1079
1079
jsonobject = CookieList .toJSONObject (" f%oo = b+l=ah ; o;n%40e = t.wo " );
0 commit comments