Skip to content

Commit 27aad26

Browse files
committed
Add SpringBatchTest as an annotation that should remove SpringExtension Fixes #223
1 parent 126eaf2 commit 27aad26

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/org/openrewrite/java/spring/boot2/UnnecessarySpringExtension.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class UnnecessarySpringExtension extends Recipe {
3535

36-
//All of the following annotations apply the @SpringExtension
36+
// All the following annotations apply the @SpringExtension
3737
private static final List<String> SPRING_BOOT_TEST_ANNOTATIONS = Arrays.asList(
3838
"org.springframework.boot.test.context.SpringBootTest",
3939
"org.springframework.boot.test.autoconfigure.jdbc.JdbcTest",
@@ -50,7 +50,8 @@ public class UnnecessarySpringExtension extends Recipe {
5050
"org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest",
5151
"org.springframework.boot.test.autoconfigure.data.neo4j.DataNeo4jTest",
5252
"org.springframework.boot.test.autoconfigure.data.r2dbc.DataR2dbcTest",
53-
"org.springframework.boot.test.autoconfigure.data.redis.DataRedisTest"
53+
"org.springframework.boot.test.autoconfigure.data.redis.DataRedisTest",
54+
"org.springframework.batch.test.context.SpringBatchTest"
5455
);
5556
private static final String EXTEND_WITH_SPRING_EXTENSION_ANNOTATION_PATTERN = "@org.junit.jupiter.api.extension.ExtendWith(org.springframework.test.context.junit.jupiter.SpringExtension.class)";
5657

@@ -76,8 +77,8 @@ protected TreeVisitor<?, ExecutionContext> getVisitor() {
7677
@Override
7778
public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, ExecutionContext ctx) {
7879

79-
//Clear the class body to make annotation search and replace faster
80-
//noinspection ConstantConditions
80+
// Clear the class body to make annotation search and replace faster
81+
// noinspection ConstantConditions
8182
J.ClassDeclaration c = classDecl.withBody(null);
8283

8384
AtomicBoolean annotationFound = new AtomicBoolean(false);
@@ -98,7 +99,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
9899
};
99100
}
100101

101-
//Using this visitor vs making 15 calls to findAnnotations.
102+
// Using this visitor vs making 15 calls to findAnnotations.
102103
private static class FindBootTestAnnotation extends JavaIsoVisitor<AtomicBoolean> {
103104

104105
@Override

0 commit comments

Comments
 (0)