diff --git a/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/parsers/CompareParserRecipeRunTest.java b/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/parsers/CompareParserRecipeRunTest.java index 3d845a8ba..1c073ee1f 100644 --- a/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/parsers/CompareParserRecipeRunTest.java +++ b/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/parsers/CompareParserRecipeRunTest.java @@ -15,6 +15,7 @@ */ package org.springframework.rewrite.parsers; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.openrewrite.ExecutionContext; diff --git a/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/test/util/ParserExecutionHelper.java b/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/test/util/ParserExecutionHelper.java index 45e6537b0..c5982d01c 100644 --- a/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/test/util/ParserExecutionHelper.java +++ b/spring-rewrite-commons-launcher/src/test/java/org/springframework/rewrite/test/util/ParserExecutionHelper.java @@ -15,6 +15,7 @@ */ package org.springframework.rewrite.test.util; +import lombok.extern.slf4j.Slf4j; import org.openrewrite.ExecutionContext; import org.openrewrite.InMemoryExecutionContext; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -34,6 +35,7 @@ /** * @author Fabian Krüger */ +@Slf4j public class ParserExecutionHelper { public ParallelParsingResult parseParallel(Path baseDir) { @@ -87,23 +89,35 @@ public RewriteProjectParsingResult parseWithComparingParser(Path baseDir, Parser ExecutionContext executionContext) { RewriteMavenProjectParser comparingParser = new ComparingParserFactory() .createComparingParser(parserProperties); - if (executionContext != null) { - return comparingParser.parse(baseDir, executionContext); + try { + if (executionContext != null) { + return comparingParser.parse(baseDir, executionContext); + } + else { + return comparingParser.parse(baseDir); + } } - else { - return comparingParser.parse(baseDir); + catch (Exception e) { + log.error("Failure while parsing with %s".formatted(RewriteMavenProjectParser.class.getName()), e); + throw new RuntimeException(e); } } public RewriteProjectParsingResult parseWithRewriteProjectParser(Path baseDir, ParserProperties parserProperties) { AtomicReference atomicRef = new AtomicReference<>(); new ApplicationContextRunner().withUserConfiguration(SbmSupportRewriteConfiguration.class) - .withBean("parser-org.springframework.parsers.rewrite.ParserProperties", ParserProperties.class, + .withBean("parser-org.springframework.rewrite.parsers.ParserProperties", ParserProperties.class, () -> parserProperties) .run(appCtx -> { - RewriteProjectParser sut = appCtx.getBean(RewriteProjectParser.class); - RewriteProjectParsingResult testedParserResult = sut.parse(baseDir); - atomicRef.set(testedParserResult); + try { + RewriteProjectParser sut = appCtx.getBean(RewriteProjectParser.class); + RewriteProjectParsingResult testedParserResult = sut.parse(baseDir); + atomicRef.set(testedParserResult); + } + catch (Exception e) { + log.error("Failure while parsing with %s".formatted(RewriteProjectParser.class.getName()), e); + throw new RuntimeException(e); + } }); return atomicRef.get(); }