From 1af2236e517002b2d413e9470a138bb1d90dc095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Kr=C3=BCger?= Date: Thu, 19 Oct 2023 21:07:23 +0200 Subject: [PATCH] fixes #975 --- .../org/springframework/sbm/parsers/ModuleParser.java | 2 +- .../sbm/parsers/CompareParserRecipeRunTest.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java index 0b1d4cc41..96f57dc0e 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java @@ -128,7 +128,7 @@ public List processMainSources( mainProjectProvenance.add(sourceSet("main", dependencies, typeCache)); // FIXME: 945 Why target and not all main? - List parsedJavaPaths = mainJavaSources.stream().map(ResourceUtil::getPath).toList(); + List parsedJavaPaths = javaSourcesInTarget.stream().map(ResourceUtil::getPath).toList(); Stream parsedJava = cus.map(addProvenance(baseDir, mainProjectProvenance, parsedJavaPaths)); log.debug("[%s] Scanned %d java source files in main scope.".formatted(currentProject, mainJavaSources.size())); diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/CompareParserRecipeRunTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/CompareParserRecipeRunTest.java index 71ca8e05f..800e406fa 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/CompareParserRecipeRunTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/CompareParserRecipeRunTest.java @@ -45,7 +45,6 @@ * @author Fabian Krüger */ @SpringBootTest(classes = {SbmSupportRewriteConfiguration.class, SbmTestConfiguration.class}) -@Issue("https://github.com/spring-projects-experimental/spring-boot-migrator/issues/975") public class CompareParserRecipeRunTest { @Autowired @@ -58,9 +57,8 @@ public class CompareParserRecipeRunTest { private ExecutionContext executionContext; @Test - @DisplayName("runningRecipe") - @ExpectedToFail("FIXME: #975") - void runningRecipe() { + @DisplayName("Running a recipe with RewriteMavenParser should yield the same result as with RewriteProjectParser") + void runningARecipeWithRewriteMavenParserYieldsTheSameResultAsWithRewriteProjectParser() { Path baseDir = TestProjectHelper.getMavenProject("parser-recipe-run"); RewriteProjectParsingResult sutParsingResult = sut.parse(baseDir); RewriteProjectParsingResult compParsingResult = comparingParser.parse(baseDir); @@ -105,7 +103,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex // Run Parser independent from Maven counter.setRelease(0); RecipeRun sutRecipeRun = recipe.run(new InMemoryLargeSourceSet(sutParsingResult.sourceFiles()), executionContext); - assertThat(counter.get()).isEqualTo(3); // differs, should be 2 + assertThat(counter.get()).isEqualTo(2); // differs, should be 2 assertThat(sutRecipeRun.getChangeset().getAllResults()).hasSize(1); // is 0 }