diff --git a/pom.xml b/pom.xml index f47c47b5..28bc4cc1 100644 --- a/pom.xml +++ b/pom.xml @@ -18,9 +18,9 @@ - ow2.org-snapshot + snapshot Maven Repository for Spoon Snapshots - https://repository.ow2.org/nexus/content/repositories/snapshots/ + https://oss.sonatype.org/content/repositories/snapshots/ @@ -29,7 +29,7 @@ fr.inria.gforge.spoon spoon-core - 10.1.1 + 10.4.1 fr.inria.gforge.spoon.labs diff --git a/src/test/java/se/kth/spork/spoon/Spoon3dmMergeTest.java b/src/test/java/se/kth/spork/spoon/Spoon3dmMergeTest.java index 8fa72dfe..a83d3b9a 100644 --- a/src/test/java/se/kth/spork/spoon/Spoon3dmMergeTest.java +++ b/src/test/java/se/kth/spork/spoon/Spoon3dmMergeTest.java @@ -3,6 +3,10 @@ import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; +import java.util.Comparator; +import java.util.List; +import java.util.Set; + import kotlin.Pair; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; @@ -69,11 +73,26 @@ private static void runTestMerge(Util.TestSources sources) { // this assert is just to give a better overview of obvious errors, but it relies on the // pretty printer's // correctness - // assertEquals(Cli.prettyPrint(expected), Cli.prettyPrint(mergeTree)); + //assertEquals(Cli.prettyPrint(expected), Cli.prettyPrint(mergeTree)); System.out.println(Cli.prettyPrint(mergeTree)); - // these asserts are what actually matters - assertEquals(expected, mergeTree); + // we cannot assert CtModules so stricly + // because the order of types is taken into account in the EqualityVisitor of Spoon + // assertEquals(expected, mergeTree); + + // so we force the order of types and assert one by one + assertTrue(expected instanceof CtModule); + final Comparator nameComparator = new Comparator<>() { + @Override + public int compare(CtType o, CtType t1) { + return o.getQualifiedName().compareTo(t1.getQualifiedName()); + } + }; + final List list1 = expected.filterChildren(c -> (c instanceof CtType)).list(); + final List list2 = mergeTree.filterChildren(c -> (c instanceof CtType)).list(); + list1.sort(nameComparator); + list2.sort(nameComparator); + assertEquals(list1, list2); assertEquals(expectedImports, mergedImports); assertEquals(expectedCuComment, mergedCuComment); }