versionToBom() {
return Stream.of(
- arguments("2.277.3", "bom-2.277.x"),
- arguments("2.319.1", "bom-2.319.x"),
- arguments("2.361.4", "bom-2.361.x"),
- arguments("2.401.2", "bom-2.401.x"),
- arguments("2.384", "bom-weekly"),
- arguments("2.401", "bom-weekly"),
- arguments("888888-SNAPSHOT", "bom-weekly"),
- arguments("2.379-rc33114.2f90818f6a_35", "bom-weekly")
+ arguments("2.277.3", "bom-2.277.x"),
+ arguments("2.319.1", "bom-2.319.x"),
+ arguments("2.361.4", "bom-2.361.x"),
+ arguments("2.401.2", "bom-2.401.x"),
+ arguments("2.384", "bom-weekly"),
+ arguments("2.401", "bom-weekly"),
+ arguments("888888-SNAPSHOT", "bom-weekly"),
+ arguments("2.379-rc33114.2f90818f6a_35", "bom-weekly")
);
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/BomLookupTest.java b/src/test/java/org/openrewrite/jenkins/BomLookupTest.java
index 857460b..5269253 100644
--- a/src/test/java/org/openrewrite/jenkins/BomLookupTest.java
+++ b/src/test/java/org/openrewrite/jenkins/BomLookupTest.java
@@ -19,7 +19,7 @@
import static org.assertj.core.api.Assertions.assertThat;
-public class BomLookupTest {
+class BomLookupTest {
private final BomLookup bomLookup = new BomLookup();
@Test
diff --git a/src/test/java/org/openrewrite/jenkins/CreateIndexJellyTest.java b/src/test/java/org/openrewrite/jenkins/CreateIndexJellyTest.java
index c828762..b715ecd 100644
--- a/src/test/java/org/openrewrite/jenkins/CreateIndexJellyTest.java
+++ b/src/test/java/org/openrewrite/jenkins/CreateIndexJellyTest.java
@@ -36,201 +36,201 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldNoOpIfIndexJellyAlreadyExists() {
rewriteRun(other("peanut butter and...", spec ->
- spec.path("src/main/resources/index.jelly")));
+ spec.path("src/main/resources/index.jelly")));
}
@Test
@DocumentExample
void shouldCreateIndexJellyFromPomDescription() {
rewriteRun(
- pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
- This is my plugin's description
- 0.1
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
- ),
- text(
- null,
- """
-
-
- This is my plugin's description
-
- """.stripIndent(),
- s -> s.path("src/main/resources/index.jelly")
- )
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+ This is my plugin's description
+ 0.1
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
+ ),
+ text(
+ null,
+ """
+
+
+ This is my plugin's description
+
+ """.stripIndent(),
+ s -> s.path("src/main/resources/index.jelly")
+ )
);
}
@Test
void shouldCreateIndexJellyEmptyDescription() {
rewriteRun(
- pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
-
- 0.1
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
- ),
- text(
- null,
- """
-
-
- my-plugin
-
- """.stripIndent(),
- s -> s.path("src/main/resources/index.jelly")
- )
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+
+ 0.1
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
+ ),
+ text(
+ null,
+ """
+
+
+ my-plugin
+
+ """.stripIndent(),
+ s -> s.path("src/main/resources/index.jelly")
+ )
);
}
@Test
void shouldCreateIndexJellyNoDescription() {
rewriteRun(
- pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
- 0.1
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
- ),
- text(
- null,
- """
-
-
- my-plugin
-
- """.stripIndent(),
- s -> s.path("src/main/resources/index.jelly")
- )
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+ 0.1
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
+ ),
+ text(
+ null,
+ """
+
+
+ my-plugin
+
+ """.stripIndent(),
+ s -> s.path("src/main/resources/index.jelly")
+ )
);
}
@Test
void shouldCreateMultipleNestedIndexJellies() {
rewriteRun(
- mavenProject("my-root",
- pomXml("""
-
- org.example
- my-root
- 0.1
- pom
-
- plugin
- different-plugin
- non-plugin
-
-
- """.stripIndent()),
- mavenProject("plugin",
- pomXml("""
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
- 0.1
- This is my plugin
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()),
- srcMainResources(
- text(null,
- """
-
-
- This is my plugin
-
- """.stripIndent(),
- s -> s.path("index.jelly"))
- )),
- mavenProject("different-plugin",
- pomXml("""
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- different-plugin
- 0.1
- This is my second, different plugin
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()),
- srcMainResources(
- text(null,
- """
-
-
- This is my second, different plugin
-
- """.stripIndent(),
- s -> s.path("index.jelly"))
- )),
- mavenProject("non-plugin",
- pomXml("""
-
- org.example
- non-plugin
- 0.1
- This is my non-plugin
-
- """.stripIndent())))
+ mavenProject("my-root",
+ pomXml("""
+
+ org.example
+ my-root
+ 0.1
+ pom
+
+ plugin
+ different-plugin
+ non-plugin
+
+
+ """.stripIndent()),
+ mavenProject("plugin",
+ pomXml("""
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+ 0.1
+ This is my plugin
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()),
+ srcMainResources(
+ text(null,
+ """
+
+
+ This is my plugin
+
+ """.stripIndent(),
+ s -> s.path("index.jelly"))
+ )),
+ mavenProject("different-plugin",
+ pomXml("""
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ different-plugin
+ 0.1
+ This is my second, different plugin
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()),
+ srcMainResources(
+ text(null,
+ """
+
+
+ This is my second, different plugin
+
+ """.stripIndent(),
+ s -> s.path("index.jelly"))
+ )),
+ mavenProject("non-plugin",
+ pomXml("""
+
+ org.example
+ non-plugin
+ 0.1
+ This is my non-plugin
+
+ """.stripIndent())))
);
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java b/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
index b18b1a1..cdd13a0 100644
--- a/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
+++ b/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
@@ -32,68 +32,68 @@ public void defaults(RecipeSpec spec) {
@DocumentExample
void shouldAddRelativePathIfMissing() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldNoOpIfRelativePathAlreadyPresent() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/IsJenkinsPluginTest.java b/src/test/java/org/openrewrite/jenkins/IsJenkinsPluginTest.java
index c6c48bf..4ddadcf 100644
--- a/src/test/java/org/openrewrite/jenkins/IsJenkinsPluginTest.java
+++ b/src/test/java/org/openrewrite/jenkins/IsJenkinsPluginTest.java
@@ -25,7 +25,7 @@
@Disabled
class IsJenkinsPluginTest implements RewriteTest {
-
+
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new IsJenkinsPlugin("*"));
@@ -35,39 +35,39 @@ public void defaults(RecipeSpec spec) {
@DocumentExample
void shouldKnowIfJenkinsPlugin() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
- 0.1
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
- my-plugin
- 0.1
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()));
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+ 0.1
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ my-plugin
+ 0.1
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/JavaxAnnotationsToSpotBugsTest.java b/src/test/java/org/openrewrite/jenkins/JavaxAnnotationsToSpotBugsTest.java
index 9f5da40..0462153 100644
--- a/src/test/java/org/openrewrite/jenkins/JavaxAnnotationsToSpotBugsTest.java
+++ b/src/test/java/org/openrewrite/jenkins/JavaxAnnotationsToSpotBugsTest.java
@@ -23,7 +23,7 @@
import static org.openrewrite.java.Assertions.java;
-public class JavaxAnnotationsToSpotBugsTest implements RewriteTest {
+class JavaxAnnotationsToSpotBugsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion().classpath("jsr305", "spotbugs-annotations"));
@@ -33,46 +33,46 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldChangeClassName() {
rewriteRun(java(
- """
- import javax.annotation.Nonnull;
-
- public class A {
- static @Nonnull String CONSTANT = "A";
- }
- """.stripIndent(),
- """
- import edu.umd.cs.findbugs.annotations.NonNull;
-
- public class A {
- static @NonNull String CONSTANT = "A";
- }
- """.stripIndent()
+ """
+ import javax.annotation.Nonnull;
+
+ public class A {
+ static @Nonnull String CONSTANT = "A";
+ }
+ """.stripIndent(),
+ """
+ import edu.umd.cs.findbugs.annotations.NonNull;
+
+ public class A {
+ static @NonNull String CONSTANT = "A";
+ }
+ """.stripIndent()
));
}
@Test
void shouldChangePackage() {
rewriteRun(java(
- """
- import javax.annotation.CheckForNull;
+ """
+ import javax.annotation.CheckForNull;
- public class A {
- @CheckForNull
- public String key() {
- return null;
- }
- }
- """.stripIndent(),
- """
- import edu.umd.cs.findbugs.annotations.CheckForNull;
-
- public class A {
- @CheckForNull
- public String key() {
- return null;
- }
- }
- """.stripIndent()
+ public class A {
+ @CheckForNull
+ public String key() {
+ return null;
+ }
+ }
+ """.stripIndent(),
+ """
+ import edu.umd.cs.findbugs.annotations.CheckForNull;
+
+ public class A {
+ @CheckForNull
+ public String key() {
+ return null;
+ }
+ }
+ """.stripIndent()
));
}
@@ -80,39 +80,39 @@ public String key() {
@DocumentExample
void shouldNotOrderImports() {
rewriteRun(java(
- """
- import javax.annotation.CheckForNull;
- import javax.annotation.Nonnull;
- import java.util.Objects;
-
- public class A {
- @CheckForNull
- public String key() {
- return null;
- }
-
- public @Nonnull String myMethod(String in) {
- return Objects.equals(in, "a") ? "yes" : "no";
- }
- }
- """.stripIndent(),
- """
- import edu.umd.cs.findbugs.annotations.NonNull;
-
- import edu.umd.cs.findbugs.annotations.CheckForNull;
- import java.util.Objects;
-
- public class A {
- @CheckForNull
- public String key() {
- return null;
- }
-
- public @NonNull String myMethod(String in) {
- return Objects.equals(in, "a") ? "yes" : "no";
- }
- }
- """.stripIndent()
+ """
+ import javax.annotation.CheckForNull;
+ import javax.annotation.Nonnull;
+ import java.util.Objects;
+
+ public class A {
+ @CheckForNull
+ public String key() {
+ return null;
+ }
+
+ public @Nonnull String myMethod(String in) {
+ return Objects.equals(in, "a") ? "yes" : "no";
+ }
+ }
+ """.stripIndent(),
+ """
+ import edu.umd.cs.findbugs.annotations.NonNull;
+
+ import edu.umd.cs.findbugs.annotations.CheckForNull;
+ import java.util.Objects;
+
+ public class A {
+ @CheckForNull
+ public String key() {
+ return null;
+ }
+
+ public @NonNull String myMethod(String in) {
+ return Objects.equals(in, "a") ? "yes" : "no";
+ }
+ }
+ """.stripIndent()
));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java b/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
index b3a5304..5ccc9dc 100644
--- a/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
+++ b/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
@@ -33,71 +33,71 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldCreateJenkinsfile() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.303.1
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """),
- text(null, """
- buildPlugin(useContainerAgent: true, configurations: [
- [ platform: 'linux', jdk: '11' ],
- [ platform: 'windows', jdk: '11' ],
- [ platform: 'linux', jdk: '17' ],
- ])""".stripIndent(),
- spec -> spec.path("Jenkinsfile")));
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.303.1
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """),
+ text(null, """
+ buildPlugin(useContainerAgent: true, configurations: [
+ [ platform: 'linux', jdk: '11' ],
+ [ platform: 'windows', jdk: '11' ],
+ [ platform: 'linux', jdk: '17' ],
+ ])""".stripIndent(),
+ spec -> spec.path("Jenkinsfile")));
}
@Test
@DocumentExample
void shouldUpdateJenkinsfile() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.303.1
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """),
- text("""
- buildPlugin()
- """.stripIndent(), """
- buildPlugin(useContainerAgent: true, configurations: [
- [ platform: 'linux', jdk: '11' ],
- [ platform: 'windows', jdk: '11' ],
- [ platform: 'linux', jdk: '17' ],
- ])
-
- """.stripIndent(),
- spec -> spec.path("Jenkinsfile")));
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.303.1
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """),
+ text("""
+ buildPlugin()
+ """.stripIndent(), """
+ buildPlugin(useContainerAgent: true, configurations: [
+ [ platform: 'linux', jdk: '11' ],
+ [ platform: 'windows', jdk: '11' ],
+ [ platform: 'linux', jdk: '17' ],
+ ])
+
+ """.stripIndent(),
+ spec -> spec.path("Jenkinsfile")));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java b/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
index 016a7c6..8f971c6 100644
--- a/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
+++ b/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
@@ -15,7 +15,6 @@
*/
package org.openrewrite.jenkins;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
@@ -32,347 +31,347 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldUseHttpsForRepositories() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldUpgradeParentTo4_51() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldNotDowngradeParent() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.52
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.52
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldUpgradeJenkinsTo2_346_3() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.277.1
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.277.1
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldNotDowngradeJenkins() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldRemoveJavaLevelProperty() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 8
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 8
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldDisableLocalResolutionForParentPom() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldRemoveVersionsOnlyIfPresentInJenkinsBom() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- junit
- junit
- 4.4
- test
-
-
- org.jenkins-ci
- annotation-indexer
- 1.16
-
-
- com.lmax
- disruptor
- 3.3.11
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- junit
- junit
- test
-
-
- org.jenkins-ci
- annotation-indexer
-
-
- com.lmax
- disruptor
- 3.3.11
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ junit
+ junit
+ 4.4
+ test
+
+
+ org.jenkins-ci
+ annotation-indexer
+ 1.16
+
+
+ com.lmax
+ disruptor
+ 3.3.11
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ junit
+ junit
+ test
+
+
+ org.jenkins-ci
+ annotation-indexer
+
+
+ com.lmax
+ disruptor
+ 3.3.11
+
+
+
+ """.stripIndent()
));
}
@@ -380,72 +379,72 @@ void shouldRemoveVersionsOnlyIfPresentInJenkinsBom() {
@DocumentExample
void shouldDoTheWorks() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.42
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.303.3
- 8
-
-
-
- org.jenkins-ci.plugins
- junit
- 1.12
-
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.346.3
-
-
-
-
- io.jenkins.tools.bom
- bom-2.346.x
- 1763.v092b_8980a_f5e
- pom
- import
-
-
-
-
-
- org.jenkins-ci.plugins
- junit
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.42
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.303.3
+ 8
+
+
+
+ org.jenkins-ci.plugins
+ junit
+ 1.12
+
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.346.3
+
+
+
+
+ io.jenkins.tools.bom
+ bom-2.346.x
+ 1763.v092b_8980a_f5e
+ pom
+ import
+
+
+
+
+
+ org.jenkins-ci.plugins
+ junit
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java b/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
index 2dc3843..36d6499 100644
--- a/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
+++ b/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
@@ -28,141 +28,141 @@ class ReplaceLibrariesWithApiPluginTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new ReplaceLibrariesWithApiPlugin(
- "io.jenkins.plugins",
- "commons-text-api",
- "1.9-5.v7ea_44fe6061c",
- Set.of(new ReplaceLibrariesWithApiPlugin.Library("org.apache.commons", "commons-text"))
+ "io.jenkins.plugins",
+ "commons-text-api",
+ "1.9-5.v7ea_44fe6061c",
+ Set.of(new ReplaceLibrariesWithApiPlugin.Library("org.apache.commons", "commons-text"))
));
}
@Test
void shouldWorkFromYamlDefinition() {
rewriteRun(spec -> spec.recipeFromResource(
- "/replace-libraries-with-api-plugin.yml",
- "org.openrewrite.jenkins.CommonsTextToApiPlugin"
+ "/replace-libraries-with-api-plugin.yml",
+ "org.openrewrite.jenkins.CommonsTextToApiPlugin"
), pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- org.apache.commons
- commons-text
- 1.9
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ org.apache.commons
+ commons-text
+ 1.9
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@Test
void shouldReplaceDirectDependencyWithApiPlugin() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- org.apache.commons
- commons-text
- 1.9
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ org.apache.commons
+ commons-text
+ 1.9
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
@@ -170,76 +170,76 @@ void shouldReplaceDirectDependencyWithApiPlugin() {
@DocumentExample
void shouldExcludeTransitivesFromBundledLibrary() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- org.apache.turbine
- turbine
- 5.1
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent(),
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
-
- 2.289.1
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
- org.apache.turbine
- turbine
- 5.1
-
-
-
- org.apache.commons
- commons-text
-
-
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """.stripIndent()
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ org.apache.turbine
+ turbine
+ 5.1
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent(),
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+
+ 2.289.1
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+ org.apache.turbine
+ turbine
+ 5.1
+
+
+
+ org.apache.commons
+ commons-text
+
+
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """.stripIndent()
));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/UpgradeHtmlUnit_3_3_0Test.java b/src/test/java/org/openrewrite/jenkins/UpgradeHtmlUnit_3_3_0Test.java
index 8f54586..0b0d30e 100644
--- a/src/test/java/org/openrewrite/jenkins/UpgradeHtmlUnit_3_3_0Test.java
+++ b/src/test/java/org/openrewrite/jenkins/UpgradeHtmlUnit_3_3_0Test.java
@@ -25,142 +25,142 @@
import static org.openrewrite.java.Assertions.java;
import static org.openrewrite.java.Assertions.srcMainJava;
-public class UpgradeHtmlUnit_3_3_0Test implements RewriteTest {
+class UpgradeHtmlUnit_3_3_0Test implements RewriteTest {
@Language("java")
private final String webClient2 = """
- package com.gargoylesoftware.htmlunit;
- import com.gargoylesoftware.htmlunit.html.HtmlPage;
- public class WebClient {
- public HtmlPage getPage(String in) { return null; }
- }
- """.stripIndent();
+ package com.gargoylesoftware.htmlunit;
+ import com.gargoylesoftware.htmlunit.html.HtmlPage;
+ public class WebClient {
+ public HtmlPage getPage(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlPage2 = """
- package com.gargoylesoftware.htmlunit.html;
- public class HtmlPage {
- public HtmlForm getFormByName(String in) { return null; }
- }
- """.stripIndent();
+ package com.gargoylesoftware.htmlunit.html;
+ public class HtmlPage {
+ public HtmlForm getFormByName(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlForm2 = """
- package com.gargoylesoftware.htmlunit.html;
- public class HtmlForm {
- public HtmlInput getInputByName(String in) { return null; }
- }
- """.stripIndent();
+ package com.gargoylesoftware.htmlunit.html;
+ public class HtmlForm {
+ public HtmlInput getInputByName(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlInput2 = """
- package com.gargoylesoftware.htmlunit.html;
- public class HtmlInput {
- public String getValueAttribute() { return ""; }
- public String getValue() { return ""; }
- public void setAttribute(String attributeName, String attributeValue) {}
- public void setValueAttribute(String newValue) {}
- public void setValue(String newValue) {}
- }
- """.stripIndent();
+ package com.gargoylesoftware.htmlunit.html;
+ public class HtmlInput {
+ public String getValueAttribute() { return ""; }
+ public String getValue() { return ""; }
+ public void setAttribute(String attributeName, String attributeValue) {}
+ public void setValueAttribute(String newValue) {}
+ public void setValue(String newValue) {}
+ }
+ """.stripIndent();
@Language("java")
private final String webClient3 = """
- package org.htmlunit;
- import org.htmlunit.html.HtmlPage;
- public class WebClient {
- public HtmlPage getPage(String in) { return null; }
- }
- """.stripIndent();
+ package org.htmlunit;
+ import org.htmlunit.html.HtmlPage;
+ public class WebClient {
+ public HtmlPage getPage(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlPage3 = """
- package org.htmlunit.html;
- public class HtmlPage {
- public HtmlForm getFormByName(String in) { return null; }
- }
- """.stripIndent();
+ package org.htmlunit.html;
+ public class HtmlPage {
+ public HtmlForm getFormByName(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlForm3 = """
- package org.htmlunit.html;
- public class HtmlForm {
- public HtmlInput getInputByName(String in) { return null; }
- }
- """.stripIndent();
+ package org.htmlunit.html;
+ public class HtmlForm {
+ public HtmlInput getInputByName(String in) { return null; }
+ }
+ """.stripIndent();
@Language("java")
private final String htmlInput3 = """
- package org.htmlunit.html;
- public class HtmlInput {
- public String getValueAttribute() { return ""; }
- public String getValue() { return ""; }
- public void setAttribute(String attributeName, String attributeValue) {}
- public void setValueAttribute(String newValue) {}
- public void setValue(String newValue) {}
- }
- """.stripIndent();
+ package org.htmlunit.html;
+ public class HtmlInput {
+ public String getValueAttribute() { return ""; }
+ public String getValue() { return ""; }
+ public void setAttribute(String attributeName, String attributeValue) {}
+ public void setValueAttribute(String newValue) {}
+ public void setValue(String newValue) {}
+ }
+ """.stripIndent();
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion().dependsOn(webClient2, htmlPage2, htmlForm2, htmlInput2, webClient3, htmlPage3, htmlForm3, htmlInput3));
spec.recipeFromResource("/META-INF/rewrite/htmlunit-3.yml", "org.openrewrite.jenkins.UpgradeHtmlUnit_3_3_0");
}
-
+
@Test
@DocumentExample
void shouldUpdateHtmlUnit() {
rewriteRun(
- srcMainJava(spec -> spec.path("org/example/HtmlUnitUse.java")),
- java("""
- package org.example;
+ srcMainJava(spec -> spec.path("org/example/HtmlUnitUse.java")),
+ java("""
+ package org.example;
- import com.gargoylesoftware.htmlunit.WebClient;
- import com.gargoylesoftware.htmlunit.html.HtmlForm;
- import com.gargoylesoftware.htmlunit.html.HtmlInput;
- import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
- import java.io.IOException;
-
- public class HtmlUnitUse {
- void run() throws IOException {
- try (WebClient webClient = new WebClient()) {
- HtmlPage page = webClient.getPage("https://htmlunit.sourceforge.io/");
- HtmlForm form = page.getFormByName("config");
- HtmlInput a = form.getInputByName("a");
- String value = a.getValueAttribute();
- assert "".equals(value);
- a.setAttribute("value", "up2");
- a.setAttribute("value2", "leave");
- a.setValueAttribute("updated");
- }
- }
- }
- """.stripIndent(),
- """
- package org.example;
-
- import org.htmlunit.WebClient;
- import org.htmlunit.html.HtmlForm;
- import org.htmlunit.html.HtmlInput;
- import org.htmlunit.html.HtmlPage;
-
- import java.io.IOException;
-
- public class HtmlUnitUse {
- void run() throws IOException {
- try (WebClient webClient = new WebClient()) {
- HtmlPage page = webClient.getPage("https://htmlunit.sourceforge.io/");
- HtmlForm form = page.getFormByName("config");
- HtmlInput a = form.getInputByName("a");
- String value = a.getValue();
- assert "".equals(value);
- a.setAttribute("value", "up2");
- a.setAttribute("value2", "leave");
- a.setValue("updated");
- }
- }
- }
- """.stripIndent())
+ import com.gargoylesoftware.htmlunit.WebClient;
+ import com.gargoylesoftware.htmlunit.html.HtmlForm;
+ import com.gargoylesoftware.htmlunit.html.HtmlInput;
+ import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+ import java.io.IOException;
+
+ public class HtmlUnitUse {
+ void run() throws IOException {
+ try (WebClient webClient = new WebClient()) {
+ HtmlPage page = webClient.getPage("https://htmlunit.sourceforge.io/");
+ HtmlForm form = page.getFormByName("config");
+ HtmlInput a = form.getInputByName("a");
+ String value = a.getValueAttribute();
+ assert "".equals(value);
+ a.setAttribute("value", "up2");
+ a.setAttribute("value2", "leave");
+ a.setValueAttribute("updated");
+ }
+ }
+ }
+ """.stripIndent(),
+ """
+ package org.example;
+
+ import org.htmlunit.WebClient;
+ import org.htmlunit.html.HtmlForm;
+ import org.htmlunit.html.HtmlInput;
+ import org.htmlunit.html.HtmlPage;
+
+ import java.io.IOException;
+
+ public class HtmlUnitUse {
+ void run() throws IOException {
+ try (WebClient webClient = new WebClient()) {
+ HtmlPage page = webClient.getPage("https://htmlunit.sourceforge.io/");
+ HtmlForm form = page.getFormByName("config");
+ HtmlInput a = form.getInputByName("a");
+ String value = a.getValue();
+ assert "".equals(value);
+ a.setAttribute("value", "up2");
+ a.setAttribute("value2", "leave");
+ a.setValue("updated");
+ }
+ }
+ }
+ """.stripIndent())
);
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/UpgradeVersionPropertyTest.java b/src/test/java/org/openrewrite/jenkins/UpgradeVersionPropertyTest.java
index 470014f..bc64762 100644
--- a/src/test/java/org/openrewrite/jenkins/UpgradeVersionPropertyTest.java
+++ b/src/test/java/org/openrewrite/jenkins/UpgradeVersionPropertyTest.java
@@ -22,7 +22,7 @@
import static org.openrewrite.maven.Assertions.pomXml;
-public class UpgradeVersionPropertyTest implements RewriteTest {
+class UpgradeVersionPropertyTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new UpgradeVersionProperty("jenkins.version", "2.364.1"));
@@ -32,73 +32,73 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldUpgrade() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.303.1
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.364.1
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """));
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.303.1
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.364.1
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """));
}
-
+
@Test
void shouldNotDowngrade() {
rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.387.1
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """));
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.387.1
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """));
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/migrate/hudson/UtilGetPastTimeStringToTimeSpanStringTest.java b/src/test/java/org/openrewrite/jenkins/migrate/hudson/UtilGetPastTimeStringToTimeSpanStringTest.java
index 578ef4b..da39165 100644
--- a/src/test/java/org/openrewrite/jenkins/migrate/hudson/UtilGetPastTimeStringToTimeSpanStringTest.java
+++ b/src/test/java/org/openrewrite/jenkins/migrate/hudson/UtilGetPastTimeStringToTimeSpanStringTest.java
@@ -27,19 +27,19 @@ class UtilGetPastTimeStringToTimeSpanStringTest implements RewriteTest {
@Language("java")
// language=java
private final String hudsonUtil = """
- package hudson;
+ package hudson;
- public class Util {
- public static String getTimeSpanString(long duration) {
- return "anything";
- }
+ public class Util {
+ public static String getTimeSpanString(long duration) {
+ return "anything";
+ }
- @Deprecated
- public static String getPastTimeString(long duration) {
- return getTimeSpanString(duration);
- }
- }
- """.stripIndent();
+ @Deprecated
+ public static String getPastTimeString(long duration) {
+ return getTimeSpanString(duration);
+ }
+ }
+ """.stripIndent();
@Override
public void defaults(RecipeSpec spec) {
@@ -51,24 +51,24 @@ public void defaults(RecipeSpec spec) {
void shouldReplaceFullyQualifiedMethodCall() {
// language=java
rewriteRun(java(
- """
- package org.example;
-
- class MyConsumer {
- String format(long timestamp) {
- return hudson.Util.getPastTimeString(timestamp);
- }
- }
- """.stripIndent(),
- """
- package org.example;
-
- class MyConsumer {
- String format(long timestamp) {
- return hudson.Util.getTimeSpanString(timestamp);
- }
- }
- """.stripIndent()
+ """
+ package org.example;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return hudson.Util.getPastTimeString(timestamp);
+ }
+ }
+ """.stripIndent(),
+ """
+ package org.example;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return hudson.Util.getTimeSpanString(timestamp);
+ }
+ }
+ """.stripIndent()
));
}
@@ -76,28 +76,28 @@ String format(long timestamp) {
void shouldReplaceImportedMethodCall() {
// language=java
rewriteRun(java(
- """
- package org.example;
-
- import hudson.Util;
-
- class MyConsumer {
- String format(long timestamp) {
- return Util.getPastTimeString(timestamp);
- }
- }
- """.stripIndent(),
- """
- package org.example;
-
- import hudson.Util;
-
- class MyConsumer {
- String format(long timestamp) {
- return Util.getTimeSpanString(timestamp);
- }
- }
- """.stripIndent()
+ """
+ package org.example;
+
+ import hudson.Util;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return Util.getPastTimeString(timestamp);
+ }
+ }
+ """.stripIndent(),
+ """
+ package org.example;
+
+ import hudson.Util;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return Util.getTimeSpanString(timestamp);
+ }
+ }
+ """.stripIndent()
));
}
@@ -105,28 +105,28 @@ String format(long timestamp) {
void shouldReplaceStaticImportedMethodCall() {
// language=java
rewriteRun(java(
- """
- package org.example;
-
- import static hudson.Util.getPastTimeString;
-
- class MyConsumer {
- String format(long timestamp) {
- return getPastTimeString(timestamp);
- }
- }
- """.stripIndent(),
- """
- package org.example;
-
- import static hudson.Util.getTimeSpanString;
-
- class MyConsumer {
- String format(long timestamp) {
- return getTimeSpanString(timestamp);
- }
- }
- """.stripIndent()
+ """
+ package org.example;
+
+ import static hudson.Util.getPastTimeString;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return getPastTimeString(timestamp);
+ }
+ }
+ """.stripIndent(),
+ """
+ package org.example;
+
+ import static hudson.Util.getTimeSpanString;
+
+ class MyConsumer {
+ String format(long timestamp) {
+ return getTimeSpanString(timestamp);
+ }
+ }
+ """.stripIndent()
));
}
}