diff --git a/dspot/src/main/java/eu/stamp_project/dspot/selector/ChangeDetectorSelector.java b/dspot/src/main/java/eu/stamp_project/dspot/selector/ChangeDetectorSelector.java index 08fce6930..ecb786872 100644 --- a/dspot/src/main/java/eu/stamp_project/dspot/selector/ChangeDetectorSelector.java +++ b/dspot/src/main/java/eu/stamp_project/dspot/selector/ChangeDetectorSelector.java @@ -18,6 +18,7 @@ import eu.stamp_project.dspot.common.compilation.DSpotCompiler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtType; @@ -122,7 +123,7 @@ public List> selectToKeep(List> amplifiedTestToBeKept) { results.getFailingTests() .forEach(failure -> { final CtMethod key = amplifiedTestToBeKept.stream() - .filter(ctMethod -> ctMethod.getSimpleName().equals(failure.testCaseName)) + .filter(ctMethod -> (ctMethod.getParent(CtClass.class).getQualifiedName() + "#" + ctMethod.getSimpleName()).equals(failure.testCaseName)) .findFirst() .get(); amplifiedThatWillBeKept.add(key); diff --git a/dspot/src/test/java/eu/stamp_project/dspot/selector/ChangeDetectorSelectorTest.java b/dspot/src/test/java/eu/stamp_project/dspot/selector/ChangeDetectorSelectorTest.java index d5ac6f4b5..02a9f386b 100644 --- a/dspot/src/test/java/eu/stamp_project/dspot/selector/ChangeDetectorSelectorTest.java +++ b/dspot/src/test/java/eu/stamp_project/dspot/selector/ChangeDetectorSelectorTest.java @@ -30,5 +30,5 @@ protected CtMethod getAmplifiedTest() { @Override protected String getContentReportFile() { return "1 amplified test fails on the new versions." + AmplificationHelper.LINE_SEPARATOR + - "test2(example.TestSuiteExample): String index out of range: -1java.lang.StringIndexOutOfBoundsException: String index out of range: -1" + AmplificationHelper.LINE_SEPARATOR;} + "example.TestSuiteExample#test2(example.TestSuiteExample): String index out of range: -1java.lang.StringIndexOutOfBoundsException: String index out of range: -1" + AmplificationHelper.LINE_SEPARATOR;} }