Open Philzen opened 3 months ago
I developing a recipe with OpenRewrite v8.27.1 and have this test:
@Test void isMigratedToMethods_whenFullyQualified() { // language=java rewriteRun(java( """ package de.foo.bar; @org.testng.annotations.Test public class BazTest { public void shouldDoStuff() { // } public void shouldDoMoreStuff() { // } } """, """ package de.foo.bar; public class BazTest { @org.junit.jupiter.api.Test public void shouldDoStuff() { // } @org.junit.jupiter.api.Test public void shouldDoMoreStuff() { // } } """ )); }
The Visitor under test contains a call to maybeAddImport("org.junit.jupiter.api.Test").
maybeAddImport("org.junit.jupiter.api.Test")
No import added, as it is not necessary.
package de.foo.bar; +import org.junit.jupiter.api.Test; + public class BazTest { @org.junit.jupiter.api.Test
Hmm; that's odd. I'd have imagined we'd have seen such an issue before, although it could be that we just look to see if I type is used, and not if all usages are fully qualified. 🤔
I developing a recipe with OpenRewrite v8.27.1 and have this test:
The Visitor under test contains a call to
maybeAddImport("org.junit.jupiter.api.Test")
.What did you expect to see?
No import added, as it is not necessary.
What did you see instead?