From 45f51983ca714f505528e81fa5c0f1f2c77402aa Mon Sep 17 00:00:00 2001 From: Sam Snyder Date: Wed, 11 Sep 2024 16:05:55 -0700 Subject: [PATCH] Use noop recipe rather than throwing an error when no recipe is configured. --- .../src/main/java/org/openrewrite/test/RewriteTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java b/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java index 2560c78f508..42af9090ac9 100644 --- a/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java +++ b/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java @@ -33,7 +33,6 @@ import org.openrewrite.remote.Remote; import org.openrewrite.tree.ParseError; -import java.io.ByteArrayInputStream; import java.nio.file.Path; import java.util.*; import java.util.concurrent.CopyOnWriteArrayList; @@ -152,10 +151,9 @@ default void rewriteRun(Consumer spec, SourceSpec... sourceSpecs) PrintOutputCapture out = new PrintOutputCapture<>(0, markerPrinter); - Recipe recipe = testMethodSpec.recipe == null ? testClassSpec.recipe : testMethodSpec.recipe; - assertThat(recipe) - .as("A recipe must be specified") - .isNotNull(); + Recipe recipe = testMethodSpec.recipe == null ? + testClassSpec.recipe == null ? Recipe.noop() : testClassSpec.recipe : + testMethodSpec.recipe; if (!(recipe instanceof AdHocRecipe) && !(recipe instanceof AdHocScanningRecipe) && !(recipe instanceof CompositeRecipe) && !(recipe.equals(Recipe.noop())) &&