@@ -391,67 +391,67 @@ public void shouldHandleArraytoString() {
391391 */
392392 @ Test
393393 public void shouldHandleEmptyArray (){
394- final JSONObject jo1 = new JSONObject ();
395- jo1 .put ("array" ,new Object []{});
396- final JSONObject jo2 = new JSONObject ();
397- jo2 .put ("array" ,new JSONArray ());
398-
399- final String expected = "<jo></jo>" ;
400- String output1 = XML .toString (jo1 ,"jo" );
401- assertTrue ("Expected an empty root tag" , expected .equals (output1 ));
402- String output2 = XML .toString (jo2 ,"jo" );
403- assertTrue ("Expected an empty root tag" , expected .equals (output2 ));
394+ final JSONObject jo1 = new JSONObject ();
395+ jo1 .put ("array" ,new Object []{});
396+ final JSONObject jo2 = new JSONObject ();
397+ jo2 .put ("array" ,new JSONArray ());
398+
399+ final String expected = "<jo></jo>" ;
400+ String output1 = XML .toString (jo1 ,"jo" );
401+ assertTrue ("Expected an empty root tag" , expected .equals (output1 ));
402+ String output2 = XML .toString (jo2 ,"jo" );
403+ assertTrue ("Expected an empty root tag" , expected .equals (output2 ));
404404 }
405405
406406 /**
407407 * Tests that the XML output for arrays is consistent when an internal array is empty.
408408 */
409409 @ Test
410410 public void shouldHandleEmptyMultiArray (){
411- final JSONObject jo1 = new JSONObject ();
412- jo1 .put ("arr" ,new Object []{"One" , new String []{}, "Four" });
413- final JSONObject jo2 = new JSONObject ();
414- jo2 .put ("arr" ,new JSONArray (new Object []{"One" , new JSONArray (new String []{}), "Four" }));
415-
416- final String expected = "<jo><arr>One</arr><arr></arr><arr>Four</arr></jo>" ;
417- String output1 = XML .toString (jo1 ,"jo" );
418- assertTrue ("Expected a matching array" , expected .equals (output1 ));
419- String output2 = XML .toString (jo2 ,"jo" );
420- assertTrue ("Expected a matching array" , expected .equals (output2 ));
411+ final JSONObject jo1 = new JSONObject ();
412+ jo1 .put ("arr" ,new Object []{"One" , new String []{}, "Four" });
413+ final JSONObject jo2 = new JSONObject ();
414+ jo2 .put ("arr" ,new JSONArray (new Object []{"One" , new JSONArray (new String []{}), "Four" }));
415+
416+ final String expected = "<jo><arr>One</arr><arr></arr><arr>Four</arr></jo>" ;
417+ String output1 = XML .toString (jo1 ,"jo" );
418+ assertTrue ("Expected a matching array" , expected .equals (output1 ));
419+ String output2 = XML .toString (jo2 ,"jo" );
420+ assertTrue ("Expected a matching array" , expected .equals (output2 ));
421421 }
422422
423423 /**
424424 * Tests that the XML output for arrays is consistent when arrays are not empty.
425425 */
426426 @ Test
427427 public void shouldHandleNonEmptyArray (){
428- final JSONObject jo1 = new JSONObject ();
429- jo1 .put ("arr" ,new String []{"One" , "Two" , "Three" });
430- final JSONObject jo2 = new JSONObject ();
431- jo2 .put ("arr" ,new JSONArray (new String []{"One" , "Two" , "Three" }));
432-
433- final String expected = "<jo><arr>One</arr><arr>Two</arr><arr>Three</arr></jo>" ;
434- String output1 = XML .toString (jo1 ,"jo" );
435- assertTrue ("Expected a non empty root tag" , expected .equals (output1 ));
436- String output2 = XML .toString (jo2 ,"jo" );
437- assertTrue ("Expected a non empty root tag" , expected .equals (output2 ));
428+ final JSONObject jo1 = new JSONObject ();
429+ jo1 .put ("arr" ,new String []{"One" , "Two" , "Three" });
430+ final JSONObject jo2 = new JSONObject ();
431+ jo2 .put ("arr" ,new JSONArray (new String []{"One" , "Two" , "Three" }));
432+
433+ final String expected = "<jo><arr>One</arr><arr>Two</arr><arr>Three</arr></jo>" ;
434+ String output1 = XML .toString (jo1 ,"jo" );
435+ assertTrue ("Expected a non empty root tag" , expected .equals (output1 ));
436+ String output2 = XML .toString (jo2 ,"jo" );
437+ assertTrue ("Expected a non empty root tag" , expected .equals (output2 ));
438438 }
439439
440440 /**
441441 * Tests that the XML output for arrays is consistent when arrays are not empty and contain internal arrays.
442442 */
443443 @ Test
444444 public void shouldHandleMultiArray (){
445- final JSONObject jo1 = new JSONObject ();
446- jo1 .put ("arr" ,new Object []{"One" , new String []{"Two" , "Three" }, "Four" });
447- final JSONObject jo2 = new JSONObject ();
448- jo2 .put ("arr" ,new JSONArray (new Object []{"One" , new JSONArray (new String []{"Two" , "Three" }), "Four" }));
449-
450- final String expected = "<jo><arr>One</arr><arr><array>Two</array><array>Three</array></arr><arr>Four</arr></jo>" ;
451- String output1 = XML .toString (jo1 ,"jo" );
452- assertTrue ("Expected a matching array" , expected .equals (output1 ));
453- String output2 = XML .toString (jo2 ,"jo" );
454- assertTrue ("Expected a matching array" , expected .equals (output2 ));
445+ final JSONObject jo1 = new JSONObject ();
446+ jo1 .put ("arr" ,new Object []{"One" , new String []{"Two" , "Three" }, "Four" });
447+ final JSONObject jo2 = new JSONObject ();
448+ jo2 .put ("arr" ,new JSONArray (new Object []{"One" , new JSONArray (new String []{"Two" , "Three" }), "Four" }));
449+
450+ final String expected = "<jo><arr>One</arr><arr><array>Two</array><array>Three</array></arr><arr>Four</arr></jo>" ;
451+ String output1 = XML .toString (jo1 ,"jo" );
452+ assertTrue ("Expected a matching array" , expected .equals (output1 ));
453+ String output2 = XML .toString (jo2 ,"jo" );
454+ assertTrue ("Expected a matching array" , expected .equals (output2 ));
455455 }
456456
457457 /**
0 commit comments