From 184a076a0d0c0b002ea025e94b64f2cdf2a61d5c Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 30 Aug 2022 14:24:11 -0700 Subject: [PATCH] Rename `Mockito3to4MigrationAdd` to `Mockito1to4Migration` since the recipe already referenced the 1To3Migration. Also added an Upgrade Maven Dependency to for mockito 4.x and updated the Junit UseMockitoExtension recipe to reference the Mockito1To4Migration. (closes #186) --- src/main/resources/META-INF/rewrite/junit5.yml | 2 +- src/main/resources/META-INF/rewrite/mockito.yml | 10 +++++++--- .../mockito/JunitMockitoUpgradeIntegrationTest.kt | 5 ++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/resources/META-INF/rewrite/junit5.yml b/src/main/resources/META-INF/rewrite/junit5.yml index 6af44b76f..97f66841d 100755 --- a/src/main/resources/META-INF/rewrite/junit5.yml +++ b/src/main/resources/META-INF/rewrite/junit5.yml @@ -131,7 +131,7 @@ tags: - junit - mockito recipeList: - - org.openrewrite.java.testing.mockito.Mockito1to3Migration + - org.openrewrite.java.testing.mockito.Mockito1to4Migration - org.openrewrite.java.testing.mockito.MockitoJUnitRunnerSilentToExtension - org.openrewrite.java.testing.junit5.RunnerToExtension: runners: diff --git a/src/main/resources/META-INF/rewrite/mockito.yml b/src/main/resources/META-INF/rewrite/mockito.yml index 18526027c..40d04e198 100644 --- a/src/main/resources/META-INF/rewrite/mockito.yml +++ b/src/main/resources/META-INF/rewrite/mockito.yml @@ -15,14 +15,18 @@ # --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.testing.mockito.Mockito3to4Migration -displayName: Mockito 4.x migration from 3.x -description: Upgrade Mockito from 3.x to 4.x. +name: org.openrewrite.java.testing.mockito.Mockito1to4Migration +displayName: Mockito 4.x upgrade +description: Upgrade Mockito from 1.x to 4.x. tags: - testing - mockito recipeList: - org.openrewrite.java.testing.mockito.Mockito1to3Migration + - org.openrewrite.maven.UpgradeDependency: + groupId: org.mockito + artifactId: mockito-junit-jupiter + version: 4.x --- type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.testing.mockito.Mockito1to3Migration diff --git a/src/test/kotlin/org/openrewrite/java/testing/mockito/JunitMockitoUpgradeIntegrationTest.kt b/src/test/kotlin/org/openrewrite/java/testing/mockito/JunitMockitoUpgradeIntegrationTest.kt index 7c8db3263..4165553c3 100755 --- a/src/test/kotlin/org/openrewrite/java/testing/mockito/JunitMockitoUpgradeIntegrationTest.kt +++ b/src/test/kotlin/org/openrewrite/java/testing/mockito/JunitMockitoUpgradeIntegrationTest.kt @@ -24,7 +24,7 @@ import org.openrewrite.java.JavaRecipeTest /** * Validates the recipes related to upgrading from Mockito 1 to Mockito 3 */ -@Suppress("unchecked") +@Suppress("unchecked", "NotNullFieldNotInitialized", "NewClassNamingConvention") class JunitMockitoUpgradeIntegrationTest : JavaRecipeTest { override val parser: JavaParser = JavaParser.fromJavaVersion() .classpath("mockito-all", "junit", "hamcrest") @@ -34,8 +34,7 @@ class JunitMockitoUpgradeIntegrationTest : JavaRecipeTest { .scanRuntimeClasspath("org.openrewrite.java.testing.junit5") .build() .activateRecipes( - "org.openrewrite.java.testing.junit5.JUnit4to5Migration", - "org.openrewrite.java.testing.mockito.Mockito1to3Migration" + "org.openrewrite.java.testing.junit5.JUnit4to5Migration" ) /**