META-INF.rewrite.mockito.yml Maven / Gradle / Ivy
#
# Copyright 2024 the original author or authors.
#
# Licensed under the Moderne Source Available License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://docs.moderne.io/licensing/moderne-source-available-license
#
# 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.MockitoBestPractices
displayName: Mockito best practices
description: Applies best practices for Mockito tests.
tags:
- testing
- mockito
recipeList:
- org.openrewrite.java.testing.mockito.Mockito1to5Migration
- org.openrewrite.java.RemoveAnnotation:
annotationPattern: "@org.mockito.junit.jupiter.MockitoSettings(strictness=org.mockito.quality.Strictness.WARN)"
- org.openrewrite.java.testing.mockito.RemoveTimesZeroAndOne
- org.openrewrite.java.testing.mockito.SimplifyMockitoVerifyWhenGiven
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.mockito.Mockito1to5Migration
displayName: Mockito 5.x upgrade
description: Upgrade Mockito from 1.x to 5.x.
tags:
- testing
- mockito
recipeList:
- org.openrewrite.java.testing.mockito.Mockito1to4Migration
- org.openrewrite.java.testing.mockito.Mockito4to5Only
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.mockito.Mockito4to5Only
displayName: Mockito 4 to 5.x upgrade only
description: Upgrade Mockito from 4.x to 5.x. Does not include 1.x to 4.x migration.
tags:
- testing
- mockito
recipeList:
- org.openrewrite.java.testing.mockito.Mockito1to4Migration
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.mockito
oldArtifactId: mockito-inline
newArtifactId: mockito-core
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.mockito
artifactId: "*"
newVersion: 5.x
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: net.bytebuddy
artifactId: byte-buddy*
newVersion: 1.15.x
- org.openrewrite.maven.RemoveDuplicateDependencies
---
type: specs.openrewrite.org/v1beta/recipe
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.java.testing.mockito.MockitoWhenOnStaticToMockStatic
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.mockito
artifactId: "*"
newVersion: 4.x
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: net.bytebuddy
artifactId: byte-buddy*
newVersion: 1.12.19
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.mockito.Mockito1to3Migration
displayName: Mockito 3.x migration from 1.x
description: Upgrade Mockito from 1.x to 3.x.
tags:
- testing
- mockito
recipeList:
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.MockitoAnnotations.Mock
newFullyQualifiedTypeName: org.mockito.Mock
- org.openrewrite.java.testing.mockito.AnyToNullable
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.Matchers
newFullyQualifiedTypeName: org.mockito.ArgumentMatchers
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyVararg()
newMethodName: any
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyObject()
newMethodName: any
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyListOf(java.lang.Class)
newMethodName: anyList
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers anyList(java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anySetOf(java.lang.Class)
newMethodName: anySet
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers anySet(java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyMapOf(java.lang.Class, java.lang.Class)
newMethodName: anyMap
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers anyMap(java.lang.Class, java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers anyMap(java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyCollectionOf()
newMethodName: anyCollection
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.ArgumentMatchers anyIterableOf()
newMethodName: anyIterable
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers isNull(java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: org.mockito.ArgumentMatchers notNull(java.lang.Class)
argumentIndex: 0
- org.openrewrite.java.ReorderMethodArguments:
methodPattern: org.mockito.MockedStatic verify(org.mockito.verification.VerificationMode, org.mockito.MockedStatic.Verification)
newParameterNames:
- verification
- mode
oldParameterNames:
- mode
- verification
- org.openrewrite.java.testing.mockito.VerifyZeroToNoMoreInteractions
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.Mockito verifyZeroInteractions(..)
newMethodName: verifyNoInteractions
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.mockito.invocation.InvocationOnMock getArgumentAt(int, java.lang.Class)
newMethodName: getArgument
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.exceptions.verification.TooLittleActualInvocations
newFullyQualifiedTypeName: org.mockito.exceptions.verification.TooFewActualInvocations
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.configuration.AnnotationEngine
newFullyQualifiedTypeName: org.mockito.plugins.AnnotationEngine
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.plugins.InstantiatorProvider
newFullyQualifiedTypeName: org.mockito.plugins.InstantiatorProvider2
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.mockito.runners.MockitoJUnitRunner
newFullyQualifiedTypeName: org.mockito.junit.MockitoJUnitRunner
- org.openrewrite.java.testing.mockito.NoInitializationForInjectMock
- org.openrewrite.java.testing.mockito.CleanupMockitoImports
- org.openrewrite.java.testing.mockito.MockUtilsToStatic
- org.openrewrite.java.testing.junit5.MockitoJUnitToMockitoExtension
- org.openrewrite.java.testing.mockito.ReplacePowerMockito
- org.openrewrite.java.dependencies.AddDependency:
groupId: org.mockito
artifactId: mockito-junit-jupiter
version: 3.x
onlyIfUsing: org.mockito.junit.jupiter.*
acceptTransitive: true
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.mockito
artifactId: "*"
newVersion: 3.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.mockito
oldArtifactId: mockito-all
newArtifactId: mockito-core
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: net.bytebuddy
artifactId: byte-buddy*
newVersion: 1.11.13