Skip to content

Commit 7db05b4

Browse files
committed
Fix package name typo which was leading to imports not being added by OutputCaptureExtension. Should fix #46 for real this time.
1 parent 1de360c commit 7db05b4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ public class OutputCaptureExtension extends Recipe {
4040
Parser.Input.fromString("package org.springframework.boot.test.system;\n" +
4141
"public interface CapturedOutput {\n" +
4242
" String getAll();\n" +
43-
"}"),
44-
Parser.Input.fromString("package org.junit.jupiter.api.extension.ExtendWith;\n" +
43+
"}"
44+
),
45+
Parser.Input.fromString("package org.junit.jupiter.api.extension;\n" +
4546
"public @interface ExtendWith {\n" +
4647
" Class[] value();\n" +
4748
"}")
@@ -115,10 +116,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
115116
))
116117
);
117118

118-
// We got a bug report that this import wasn't being added
119-
// Couldn't reproduce why, assumed that type attribution failed for reasons that aren't obvious.
120-
// Setting onlyIfReferenced to "false" just to be sure.
121-
doAfterVisit(new AddImport<>("org.springframework.boot.test.system.OutputCaptureExtension", null, false));
119+
maybeAddImport("org.springframework.boot.test.system.OutputCaptureExtension");
122120
maybeAddImport("org.junit.jupiter.api.extension.ExtendWith");
123121
}
124122

0 commit comments

Comments
 (0)