diff --git a/src/test/kotlin/org/openrewrite/java/migrate/JavaVersion11Test.kt b/src/test/kotlin/org/openrewrite/java/migrate/JavaVersion11Test.kt index d4bf29e25a..f57696b9a3 100644 --- a/src/test/kotlin/org/openrewrite/java/migrate/JavaVersion11Test.kt +++ b/src/test/kotlin/org/openrewrite/java/migrate/JavaVersion11Test.kt @@ -15,21 +15,22 @@ */ package org.openrewrite.java.migrate -import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.openrewrite.Recipe import org.openrewrite.config.Environment -import org.openrewrite.maven.MavenRecipeTest +import org.openrewrite.maven.Assertions.pomXml +import org.openrewrite.test.RecipeSpec +import org.openrewrite.test.RewriteTest -class JavaVersion11Test : MavenRecipeTest { - override val recipe: Recipe = Environment.builder() - .scanRuntimeClasspath("org.openrewrite.java.migrate") - .build() - .activateRecipes("org.openrewrite.java.migrate.JavaVersion11") +class JavaVersion11Test : RewriteTest { + override fun defaults(spec: RecipeSpec) { + spec.recipe(Environment.builder() + .scanRuntimeClasspath("org.openrewrite.java.migrate") + .build().activateRecipes("org.openrewrite.java.migrate.JavaVersion11")) + } @Test - fun changeJavaVersion() = assertChanged( - before = """ + fun changeJavaVersion() = rewriteRun ( + pomXml(""" 4.0.0 @@ -41,8 +42,7 @@ class JavaVersion11Test : MavenRecipeTest { my-app 1 - """, - after = """ + """, """ 4.0.0 @@ -55,11 +55,12 @@ class JavaVersion11Test : MavenRecipeTest { 1 """ + ) ) @Test - fun changeMavenCompiler() = assertChanged( - before = """ + fun changeMavenCompiler() = rewriteRun ( + pomXml(""" 4.0.0 @@ -73,7 +74,7 @@ class JavaVersion11Test : MavenRecipeTest { 1 """, - after = """ + """ 4.0.0 @@ -86,6 +87,6 @@ class JavaVersion11Test : MavenRecipeTest { my-app 1 - """ + """) ) } \ No newline at end of file diff --git a/src/test/kotlin/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.kt b/src/test/kotlin/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.kt index 957a1901a8..b4d4d4b69d 100644 --- a/src/test/kotlin/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.kt +++ b/src/test/kotlin/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoMavenPluginVersionTest.kt @@ -16,19 +16,21 @@ package org.openrewrite.java.migrate.jacoco import org.junit.jupiter.api.Test -import org.openrewrite.Recipe import org.openrewrite.config.Environment -import org.openrewrite.maven.MavenRecipeTest - -class UpgradeJaCoCoMavenPluginVersionTest : MavenRecipeTest { - override val recipe: Recipe = Environment.builder() - .scanRuntimeClasspath("org.openrewrite.java.migrate.jacoco") - .build() - .activateRecipes("org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion") +import org.openrewrite.maven.Assertions.pomXml +import org.openrewrite.test.RecipeSpec +import org.openrewrite.test.RewriteTest +class UpgradeJaCoCoMavenPluginVersionTest : RewriteTest { + override fun defaults(spec: RecipeSpec) { + spec.recipe(Environment.builder() + .scanRuntimeClasspath("org.openrewrite.java.migrate.jacoco") + .build() + .activateRecipes("org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion")) + } @Test - fun property() = assertChanged( - before = """ + fun property() = rewriteRun( + pomXml(""" 4.0.0 @@ -64,7 +66,7 @@ class UpgradeJaCoCoMavenPluginVersionTest : MavenRecipeTest { """, - after = """ + """ 4.0.0 @@ -99,6 +101,6 @@ class UpgradeJaCoCoMavenPluginVersionTest : MavenRecipeTest { - """ + """) ) } diff --git a/src/test/kotlin/org/openrewrite/java/migrate/wro4j/UpgradeWro4jMavenPluginVersionTest.kt b/src/test/kotlin/org/openrewrite/java/migrate/wro4j/UpgradeWro4jMavenPluginVersionTest.kt index 5aabc81f71..cf5e0c1bc5 100644 --- a/src/test/kotlin/org/openrewrite/java/migrate/wro4j/UpgradeWro4jMavenPluginVersionTest.kt +++ b/src/test/kotlin/org/openrewrite/java/migrate/wro4j/UpgradeWro4jMavenPluginVersionTest.kt @@ -16,20 +16,23 @@ package org.openrewrite.java.migrate.wro4j import org.junit.jupiter.api.Test -import org.openrewrite.Recipe import org.openrewrite.config.Environment -import org.openrewrite.maven.MavenRecipeTest +import org.openrewrite.maven.Assertions.pomXml +import org.openrewrite.test.RecipeSpec +import org.openrewrite.test.RewriteTest -class UpgradeWro4jMavenPluginVersionTest : MavenRecipeTest { - override val recipe: Recipe = Environment.builder() - .scanRuntimeClasspath("org.openrewrite.java.migrate.wro4j") - .build() - .activateRecipes("org.openrewrite.java.migrate.wro4j.UpgradeWro4jMavenPluginVersion") +class UpgradeWro4jMavenPluginVersionTest : RewriteTest { + override fun defaults(spec: RecipeSpec) { + spec.recipe(Environment.builder() + .scanRuntimeClasspath("org.openrewrite.java.migrate.wro4j") + .build() + .activateRecipes("org.openrewrite.java.migrate.wro4j.UpgradeWro4jMavenPluginVersion")) + } @Test - fun property() = assertChanged( + fun property() = rewriteRun( // As taken from Spring PetClinic 1.5.x - before = """ + pomXml(""" 4.0.0 @@ -74,7 +77,7 @@ class UpgradeWro4jMavenPluginVersionTest : MavenRecipeTest { """, - after = """ + """ 4.0.0 @@ -118,6 +121,6 @@ class UpgradeWro4jMavenPluginVersionTest : MavenRecipeTest { - """ + """) ) }