rewrite-spring
rewrite-spring copied to clipboard
Replace @MockBean and @SpyBean recipe incorrectly migrates @MockBeans({@MockBean(class)}
What version of OpenRewrite are you using?
I am using
- OpenRewrite v6.3.2
- Maven/Gradle plugin v6.3.2
- rewrite-spring v6.3.0
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multiple module project.
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.3.2</version>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.spring.boot3.ReplaceMockBeanAndSpyBean</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-spring</artifactId>
<version>6.3.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
What is the smallest, simplest way to reproduce the problem?
have any JUNIT test with the following structure
@MockBeans({@MockBean(ClassA.class), @MockBean(ClassB.class)})
class SomeTest {
}
What did you expect to see?
@MockitoBean(types = {ClassA.class, ClassB.class})
class SomeTest {
}
or
@MockitoBeans(@MockitoBean(types = ClassA.class), @MockitoBean(types =ClassB.class)})
class SomeTest {
}
What did you see instead?
@MockBeans({@MockitoBean, @MockitoBean})
class SomeTest {
}
What is the full stack trace of any errors you encountered?
none for the test with this issue
Are you interested in [contributing a fix to OpenRewrite]
not at the moment
Thanks for the report! Seems indeed like we should ensure we handle annotations nested as annotations arguments correctly.