diff --git a/src/main/resources/META-INF/rewrite/micrometer.yml b/src/main/resources/META-INF/rewrite/micrometer.yml index 404a5c6..305feb4 100644 --- a/src/main/resources/META-INF/rewrite/micrometer.yml +++ b/src/main/resources/META-INF/rewrite/micrometer.yml @@ -19,7 +19,7 @@ name: org.openrewrite.micrometer.UpgradeMicrometer displayName: Upgrade Micrometer description: This recipe will apply changes commonly needed when migrating Micrometer. recipeList: - - org.openrewrite.java.dependencies.ChangeDependency: - oldGroupId: io.micrometer - oldArtifactId: micrometer-core + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: io.micrometer + artifactId: micrometer-core newVersion: 1.x diff --git a/src/test/java/org/openrewrite/micrometer/UpgradeMicrometer.java b/src/test/java/org/openrewrite/micrometer/UpgradeMicrometer.java index 31f3878..db7580a 100644 --- a/src/test/java/org/openrewrite/micrometer/UpgradeMicrometer.java +++ b/src/test/java/org/openrewrite/micrometer/UpgradeMicrometer.java @@ -22,10 +22,8 @@ import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; -import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.openrewrite.maven.Assertions.pomXml; class UpgradeMicrometer implements RewriteTest { @@ -45,7 +43,7 @@ void maven() { rewriteRun( //language=xml pomXml( - """ + """ @@ -62,27 +60,23 @@ void maven() { """, - spec -> spec.after(actual -> { - Matcher matcher = Pattern.compile("(1\\.1[1-9]\\.\\d+)").matcher(actual); - assertTrue(matcher.find(), actual); - return """ - - - 4.0.0 - com.example - demo - 0.0.1-SNAPSHOT - - - io.micrometer - micrometer-core - %s - - - - """.formatted(matcher.group(1)); - }))); + spec -> spec.after(actual -> """ + + + 4.0.0 + com.example + demo + 0.0.1-SNAPSHOT + + + io.micrometer + micrometer-core + %s + + + + """.formatted(Pattern.compile("(1\\.1[1-9]\\.\\d+)").matcher(actual).results().findFirst().orElseThrow().group(1))))); } } } \ No newline at end of file