From 216983b304a1eee1c1b8e857b663658af8fcb111 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 15 Jan 2024 21:57:44 +0100 Subject: [PATCH] Move mockito-all to mockito-core; Split off powermockito.yml Fixes https://github.com/openrewrite/rewrite-testing-frameworks/issues/457 --- .../resources/META-INF/rewrite/mockito.yml | 45 ++------------- .../META-INF/rewrite/powermockito.yml | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 src/main/resources/META-INF/rewrite/powermockito.yml diff --git a/src/main/resources/META-INF/rewrite/mockito.yml b/src/main/resources/META-INF/rewrite/mockito.yml index 8636506e9..03a55c5de 100644 --- a/src/main/resources/META-INF/rewrite/mockito.yml +++ b/src/main/resources/META-INF/rewrite/mockito.yml @@ -143,44 +143,7 @@ recipeList: groupId: org.mockito artifactId: "*" newVersion: 3.x ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.testing.mockito.ReplacePowerMockito -displayName: Replace PowerMock with raw Mockito -description: Replace PowerMock with raw Mockito. -tags: - - testing - - mockito -recipeList: - - org.openrewrite.java.RemoveAnnotation: - annotationPattern: "@org.powermock.core.classloader.annotations.PowerMockIgnore" - - org.openrewrite.java.ChangeMethodTargetToStatic: - methodPattern: org.powermock.api.mockito.PowerMockito mockStatic(..) - fullyQualifiedTargetTypeName: org.mockito.Mockito - returnType: org.mockito.MockedStatic - matchOverrides: null - matchUnknownTypes: - - org.openrewrite.java.ChangeMethodTargetToStatic: - methodPattern: org.powermock.api.mockito.PowerMockito do*(..) - fullyQualifiedTargetTypeName: org.mockito.Mockito - matchOverrides: null - matchUnknownTypes: null - - org.openrewrite.java.ChangeMethodTargetToStatic: - methodPattern: org.powermock.api.mockito.PowerMockito mock(..) - fullyQualifiedTargetTypeName: org.mockito.Mockito - matchOverrides: null - matchUnknownTypes: null - - org.openrewrite.java.ChangeMethodTargetToStatic: - methodPattern: org.powermock.api.mockito.PowerMockito spy(..) - fullyQualifiedTargetTypeName: org.mockito.Mockito - matchOverrides: null - matchUnknownTypes: null - - org.openrewrite.java.ChangeMethodTargetToStatic: - methodPattern: org.powermock.api.mockito.PowerMockito when(..) - fullyQualifiedTargetTypeName: org.mockito.Mockito - matchOverrides: null - matchUnknownTypes: null - - org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito - - org.openrewrite.java.dependencies.RemoveDependency: - groupId: org.powermock - artifactId: powermock-api-mockito* + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.mockito + oldArtifactId: mockito-all + newArtifactId: mockito-core diff --git a/src/main/resources/META-INF/rewrite/powermockito.yml b/src/main/resources/META-INF/rewrite/powermockito.yml new file mode 100644 index 000000000..58d38e445 --- /dev/null +++ b/src/main/resources/META-INF/rewrite/powermockito.yml @@ -0,0 +1,57 @@ +# +# Copyright 2024 the original author or authors. +#

+# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#

+# https://www.apache.org/licenses/LICENSE-2.0 +#

+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.testing.mockito.ReplacePowerMockito +displayName: Replace PowerMock with raw Mockito +description: Replace PowerMock with raw Mockito. +tags: + - testing + - mockito +recipeList: + - org.openrewrite.java.RemoveAnnotation: + annotationPattern: "@org.powermock.core.classloader.annotations.PowerMockIgnore" + - org.openrewrite.java.ChangeMethodTargetToStatic: + methodPattern: org.powermock.api.mockito.PowerMockito mockStatic(..) + fullyQualifiedTargetTypeName: org.mockito.Mockito + returnType: org.mockito.MockedStatic + matchOverrides: null + matchUnknownTypes: + - org.openrewrite.java.ChangeMethodTargetToStatic: + methodPattern: org.powermock.api.mockito.PowerMockito do*(..) + fullyQualifiedTargetTypeName: org.mockito.Mockito + matchOverrides: null + matchUnknownTypes: null + - org.openrewrite.java.ChangeMethodTargetToStatic: + methodPattern: org.powermock.api.mockito.PowerMockito mock(..) + fullyQualifiedTargetTypeName: org.mockito.Mockito + matchOverrides: null + matchUnknownTypes: null + - org.openrewrite.java.ChangeMethodTargetToStatic: + methodPattern: org.powermock.api.mockito.PowerMockito spy(..) + fullyQualifiedTargetTypeName: org.mockito.Mockito + matchOverrides: null + matchUnknownTypes: null + - org.openrewrite.java.ChangeMethodTargetToStatic: + methodPattern: org.powermock.api.mockito.PowerMockito when(..) + fullyQualifiedTargetTypeName: org.mockito.Mockito + matchOverrides: null + matchUnknownTypes: null + - org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito + - org.openrewrite.java.dependencies.RemoveDependency: + groupId: org.powermock + artifactId: powermock-api-mockito*