Skip to content

Commit

Permalink
Add ReplaceMockBeanAndSpyBean Recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
123Haynes committed Dec 6, 2024
1 parent 0fdc027 commit 408f88d
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 157 deletions.

This file was deleted.

48 changes: 48 additions & 0 deletions src/main/resources/META-INF/rewrite/replace-mock-and-spybean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright 2024 the original author or authors.
# <p>
# 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
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# 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.boot3.ReplaceMockBeanAndSpyBean
displayName: Replace `@MockBean` and `@SpyBean`
description: Replaces `@MockBean` and `@SpyBean` annotations with `@MockitoBean` and `@MockitoSpyBean`.
recipeList:
- org.openrewrite.java.ChangeAnnotationAttributeName:
annotationType: org.springframework.boot.test.mock.mockito.MockBean
oldAttributeName: answer
newAttributeName: answers
- org.openrewrite.java.RemoveAnnotationAttribute:
annotationType: org.springframework.boot.test.mock.mockito.MockBean
attributeName: classes
- org.openrewrite.java.RemoveAnnotationAttribute:
annotationType: org.springframework.boot.test.mock.mockito.MockBean
attributeName: value
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.test.mock.mockito.MockBean
newFullyQualifiedTypeName: org.springframework.test.context.bean.override.mockito.MockitoBean

- org.openrewrite.java.RemoveAnnotationAttribute:
annotationType: org.springframework.boot.test.mock.mockito.SpyBean
attributeName: classes
- org.openrewrite.java.RemoveAnnotationAttribute:
annotationType: org.springframework.boot.test.mock.mockito.SpyBean
attributeName: value
- org.openrewrite.java.RemoveAnnotationAttribute:
annotationType: org.springframework.boot.test.mock.mockito.SpyBean
attributeName: proxyTargetAware
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.test.mock.mockito.SpyBean
newFullyQualifiedTypeName: org.springframework.test.context.bean.override.mockito.MockitoSpyBean
Loading

0 comments on commit 408f88d

Please sign in to comment.