@@ -650,39 +650,6 @@ public void wrapObject() {
650650 // TODO test wrap(package)
651651 }
652652
653- @ Test
654- public void jsonObjectEquals () {
655- String str =
656- "{" +
657- "\" trueKey\" :true," +
658- "\" falseKey\" :false," +
659- "\" arrayKey\" :[0,1,2]," +
660- "\" objectKey\" :{" +
661- "\" myKey1\" :\" myVal1\" ," +
662- "\" myKey2\" :\" myVal2\" ," +
663- "\" myKey3\" :\" myVal3\" ," +
664- "\" myKey4\" :\" myVal4\" " +
665- "}" +
666- "}" ;
667- String diffStr =
668- "{" +
669- "\" arrayKey\" :[0]" +
670- "}" ;
671- JSONObject jsonObject = new JSONObject (str );
672- JSONObject otherJsonObject = new JSONObject (str );
673- JSONObject unequalJsonObject = new JSONObject (diffStr );
674- assertTrue ("equal JSONObjects should be equal" ,
675- jsonObject .equals (otherJsonObject ));
676- assertTrue ("unequal JSONObjects should not be equal" ,
677- !jsonObject .equals (unequalJsonObject ));
678-
679- // make sure hashcode returns some interesting value
680- assertTrue ("equal JSONObjects should have equal hashCode" ,
681- jsonObject .hashCode () == otherJsonObject .hashCode ());
682- assertTrue ("unequal JSONObjects should have unequal hashCode" ,
683- jsonObject .hashCode () != unequalJsonObject .hashCode ());
684- }
685-
686653 @ Test
687654 public void jsonObjectParsingErrors () {
688655 int tryCount = 0 ;
@@ -869,13 +836,8 @@ public void write() {
869836 public void equals () {
870837 String str = "{\" key\" :\" value\" }" ;
871838 JSONObject aJsonObject = new JSONObject (str );
872- JSONObject bJsonObject = new JSONObject (str );
873839 assertTrue ("Same JSONObject should be equal to itself" ,
874840 aJsonObject .equals (aJsonObject ));
875- assertTrue ("JSONObjects with equal content should be equal" ,
876- aJsonObject .equals (bJsonObject ));
877- assertTrue ("JSONObjects should not be equal to non J" ,
878- !aJsonObject .equals (new String ()));
879841 }
880842}
881843
0 commit comments