Skip to content

Commit

Permalink
Fix intermittent test failures in Scatter Gather tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SanojPunchihewa committed Dec 17, 2024
1 parent 92d5e2a commit 74240e9
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import org.xml.sax.SAXException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down Expand Up @@ -252,8 +255,16 @@ private static boolean areJsonElementsEquivalent(JsonElement e1, JsonElement e2)
return false;
}

for (int i = 0; i < e1.getAsJsonArray().size(); i++) {
if (!areJsonElementsEquivalent(e1.getAsJsonArray().get(i), e2.getAsJsonArray().get(i))) {
List<JsonElement> list1 = new ArrayList<>();
e1.getAsJsonArray().forEach(list1::add);
List<JsonElement> list2 = new ArrayList<>();
e2.getAsJsonArray().forEach(list2::add);

list1.sort(Comparator.comparing(JsonElement::toString));
list2.sort(Comparator.comparing(JsonElement::toString));

for (int i = 0; i < list1.size(); i++) {
if (!areJsonElementsEquivalent(list1.get(i), list2.get(i))) {
return false;
}
}
Expand Down

0 comments on commit 74240e9

Please sign in to comment.