@@ -698,7 +698,7 @@ void fetchGetHttps() {
698698 U .FetchResponse result =
699699 U .fetch (
700700 "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
701- + "main/src/test/resources/example.json" );
701+ + "main/src/test/resources/example.json" );
702702 assertEquals (
703703 "{\n "
704704 + " \" fruit\" : \" Apple\" ,\n "
@@ -793,50 +793,53 @@ public int read(byte[] b) throws IOException {
793793
794794 @ Test
795795 void testSuccessfulReadOnFirstAttempt () throws IOException {
796- java .io .InputStream inputStream = new TestInputStream (new int []{100 }, null );
796+ java .io .InputStream inputStream = new TestInputStream (new int [] {100 }, null );
797797 byte [] buffer = new byte [1024 ];
798798 int result = U .readWithRetry (inputStream , buffer );
799799 assertEquals (100 , result );
800800 }
801801
802802 @ Test
803803 void testSuccessfulReadOnSecondAttempt () throws IOException {
804- java .io .InputStream inputStream = new TestInputStream (
805- new int []{ 0 , 50 },
806- new IOException []{ new IOException ( "First failed" ), null }
807- );
804+ java .io .InputStream inputStream =
805+ new TestInputStream (
806+ new int [] { 0 , 50 },
807+ new IOException [] { new IOException ( "First failed" ), null } );
808808 byte [] buffer = new byte [1024 ];
809809 int result = U .readWithRetry (inputStream , buffer );
810810 assertEquals (50 , result );
811811 }
812812
813813 @ Test
814814 void testBothAttemptsFailWithIOException () {
815- java .io .InputStream inputStream = new TestInputStream (
816- null ,
817- new IOException []{
818- new IOException ( "First attempt failed" ),
819- new IOException ("Second attempt failed" )
820- }
821- );
815+ java .io .InputStream inputStream =
816+ new TestInputStream (
817+ null ,
818+ new IOException [] {
819+ new IOException ("First attempt failed" ),
820+ new IOException ( "Second attempt failed" )
821+ } );
822822 byte [] buffer = new byte [1024 ];
823- IOException thrown = assertThrows (IOException .class , () -> {
824- U .readWithRetry (inputStream , buffer );
825- });
823+ IOException thrown =
824+ assertThrows (
825+ IOException .class ,
826+ () -> {
827+ U .readWithRetry (inputStream , buffer );
828+ });
826829 assertEquals ("Second attempt failed" , thrown .getMessage ());
827830 }
828831
829832 @ Test
830833 void testReadReturnsMinusOne () throws IOException {
831- java .io .InputStream inputStream = new TestInputStream (new int []{-1 }, null );
834+ java .io .InputStream inputStream = new TestInputStream (new int [] {-1 }, null );
832835 byte [] buffer = new byte [1024 ];
833836 int result = U .readWithRetry (inputStream , buffer );
834837 assertEquals (-1 , result );
835838 }
836839
837840 @ Test
838841 void testReadReturnsZero () throws IOException {
839- java .io .InputStream inputStream = new TestInputStream (new int []{0 }, null );
842+ java .io .InputStream inputStream = new TestInputStream (new int [] {0 }, null );
840843 byte [] buffer = new byte [1024 ];
841844 int result = U .readWithRetry (inputStream , buffer );
842845 assertEquals (0 , result );
@@ -1122,13 +1125,31 @@ void xmpToJson6() {
11221125 + " },\n "
11231126 + " \" omit-xml-declaration\" : \" yes\" \n "
11241127 + "}" ,
1125- U .xmlToJson ("<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n "
1126- + "<root>\n "
1127- + " <root>\n "
1128- + " <a number=\" true\" >1</a>\n "
1129- + " </root>\n "
1130- + " <omit-xml-declaration>yes</omit-xml-declaration>\n "
1131- + "</root>" ));
1128+ U .xmlToJson (
1129+ "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n "
1130+ + "<root>\n "
1131+ + " <root>\n "
1132+ + " <a number=\" true\" >1</a>\n "
1133+ + " </root>\n "
1134+ + " <omit-xml-declaration>yes</omit-xml-declaration>\n "
1135+ + "</root>" ));
1136+ assertEquals (
1137+ "{\n "
1138+ + " \" root\" : [\n "
1139+ + " {\n "
1140+ + " \" a\" : 1\n "
1141+ + " }\n "
1142+ + " ],\n "
1143+ + " \" omit-xml-declaration\" : \" yes\" \n "
1144+ + "}" ,
1145+ U .xmlToJson (
1146+ "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n "
1147+ + "<root>\n "
1148+ + " <root array=\" true\" >\n "
1149+ + " <a number=\" true\" >1</a>\n "
1150+ + " </root>\n "
1151+ + " <omit-xml-declaration>yes</omit-xml-declaration>\n "
1152+ + "</root>" ));
11321153 }
11331154
11341155 @ Test
0 commit comments