diff --git a/src/main/java/org/openrewrite/jenkins/UpgradeJavaVersion.java b/src/main/java/org/openrewrite/jenkins/UpgradeJavaVersion.java index 98e89e7..e4ea24c 100644 --- a/src/main/java/org/openrewrite/jenkins/UpgradeJavaVersion.java +++ b/src/main/java/org/openrewrite/jenkins/UpgradeJavaVersion.java @@ -54,8 +54,8 @@ public String getDescription() { public TreeVisitor getVisitor() { return Preconditions.check(new FindSourceFiles("**/Jenkinsfile"), new GroovyIsoVisitor() { @Override - public J.Assignment visitAssignment(J.Assignment assignment, ExecutionContext executionContext) { - J.Assignment a = super.visitAssignment(assignment, executionContext); + public J.Assignment visitAssignment(J.Assignment assignment, ExecutionContext ctx) { + J.Assignment a = super.visitAssignment(assignment, ctx); if (!(a.getVariable() instanceof J.Identifier) || !(a.getAssignment() instanceof J.Literal)) { return a; } diff --git a/src/test/java/org/openrewrite/jenkins/UpgradeJavaVersionTest.java b/src/test/java/org/openrewrite/jenkins/UpgradeJavaVersionTest.java index 45dcc13..d3f8939 100644 --- a/src/test/java/org/openrewrite/jenkins/UpgradeJavaVersionTest.java +++ b/src/test/java/org/openrewrite/jenkins/UpgradeJavaVersionTest.java @@ -16,23 +16,26 @@ package org.openrewrite.jenkins; import org.junit.jupiter.api.Test; +import org.openrewrite.DocumentExample; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; import static org.openrewrite.groovy.Assertions.groovy; -public class UpgradeJavaVersionTest implements RewriteTest { +class UpgradeJavaVersionTest implements RewriteTest { @Override public void defaults(RecipeSpec spec) { spec.recipe(new UpgradeJavaVersion(17, null)); } + @DocumentExample @Test void openJdk() { rewriteRun( //language=groovy - groovy(""" + groovy( + """ #!/usr/bin/env groovy stage("Checkout") { @@ -61,7 +64,8 @@ void jdk() { rewriteRun( spec -> spec.recipe(new UpgradeJavaVersion(17, "openjdk")), //language=groovy - groovy(""" + groovy( + """ node('cicd-build') { stage ("Titan") { titan {