@@ -1111,6 +1111,7 @@ public void testIndentComplicatedJsonObject(){
1111
1111
"}" ;
1112
1112
JSONObject jsonObject = new JSONObject (str );
1113
1113
String actualIndentedXmlString = XML .toString (jsonObject , 1 );
1114
+ JSONObject actualJsonObject = XML .toJSONObject (actualIndentedXmlString );
1114
1115
String expected = "<success>true</success>\n " +
1115
1116
"<response>\n " +
1116
1117
" <dateTimeISO>2022-10-05T00:00:00+03:00</dateTimeISO>\n " +
@@ -1170,7 +1171,8 @@ public void testIndentComplicatedJsonObject(){
1170
1171
" <timestamp>1664917200</timestamp>\n " +
1171
1172
"</response>\n " +
1172
1173
"<error>null</error>\n " ;
1173
- assertEquals (actualIndentedXmlString , expected );
1174
+ JSONObject expectedJsonObject = XML .toJSONObject (expected );
1175
+ assertTrue (expectedJsonObject .similar (actualJsonObject ));
1174
1176
1175
1177
1176
1178
}
@@ -1183,14 +1185,16 @@ public void testIndentSimpleJsonObject(){
1183
1185
" }}" ;
1184
1186
JSONObject jsonObject = new JSONObject (str );
1185
1187
String actual = XML .toString (jsonObject , "Test" , 2 );
1188
+ JSONObject actualJsonObject = XML .toJSONObject (actual );
1186
1189
String expected = "<Test>\n " +
1187
1190
" <employee>\n " +
1188
1191
" <name>sonoo</name>\n " +
1189
1192
" <salary>56000</salary>\n " +
1190
1193
" <married>true</married>\n " +
1191
1194
" </employee>\n " +
1192
1195
"</Test>\n " ;
1193
- assertEquals (actual , expected );
1196
+ JSONObject expectedJsonObject = XML .toJSONObject (expected );
1197
+ assertTrue (expectedJsonObject .similar (actualJsonObject ));
1194
1198
}
1195
1199
1196
1200
@ Test
@@ -1201,6 +1205,7 @@ public void testIndentSimpleJsonArray(){
1201
1205
"] " ;
1202
1206
JSONArray jsonObject = new JSONArray (str );
1203
1207
String actual = XML .toString (jsonObject , 2 );
1208
+ JSONObject actualJsonObject = XML .toJSONObject (actual );
1204
1209
String expected = "<array>\n " +
1205
1210
" <name>Ram</name>\n " +
1206
1211
" <email>[email protected] </email>\n " +
@@ -1209,7 +1214,8 @@ public void testIndentSimpleJsonArray(){
1209
1214
" <name>Bob</name>\n " +
1210
1215
" <email>[email protected] </email>\n " +
1211
1216
"</array>\n " ;
1212
- assertEquals (actual , expected );
1217
+ JSONObject expectedJsonObject = XML .toJSONObject (expected );
1218
+ assertTrue (expectedJsonObject .similar (actualJsonObject ));
1213
1219
1214
1220
1215
1221
}
0 commit comments