Skip to content

Commit e6d7904

Browse files
committed
No need to enable Lombok to rename a field
1 parent 8c04880 commit e6d7904

File tree

1 file changed

+23
-40
lines changed

1 file changed

+23
-40
lines changed

src/test/java/org/openrewrite/java/migrate/lombok/log/ConvertToLogAnnotationTest.java

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.openrewrite.java.migrate.lombok.log;
1717

18-
import org.junit.jupiter.api.AfterAll;
19-
import org.junit.jupiter.api.BeforeAll;
20-
import org.junit.jupiter.api.Nested;
2118
import org.junit.jupiter.api.Test;
2219
import org.junit.jupiter.params.ParameterizedTest;
2320
import org.junit.jupiter.params.provider.ValueSource;
@@ -58,47 +55,33 @@ class A {
5855
);
5956
}
6057

61-
@Nested
62-
class RenameField {
63-
64-
@BeforeAll
65-
static void setUp() {
66-
System.setProperty("rewrite.lombok", "true");
67-
}
68-
69-
@AfterAll
70-
static void tearDown() {
71-
System.clearProperty("rewrite.lombok");
72-
}
73-
74-
@Test
75-
void replaceSlf4jAndRenameFieldUsages() {
76-
rewriteRun(
77-
// language=java
78-
java(
79-
"""
80-
class A {
81-
private static final org.slf4j.Logger renamed = org.slf4j.LoggerFactory.getLogger(A.class);
82-
83-
void test() {
84-
renamed.info("test");
85-
}
58+
@Test
59+
void replaceSlf4jAndRenameFieldUsages() {
60+
rewriteRun(
61+
// language=java
62+
java(
63+
"""
64+
class A {
65+
private static final org.slf4j.Logger renamed = org.slf4j.LoggerFactory.getLogger(A.class);
66+
67+
void test() {
68+
renamed.info("test");
8669
}
87-
""",
88-
"""
89-
import lombok.extern.slf4j.Slf4j;
70+
}
71+
""",
72+
"""
73+
import lombok.extern.slf4j.Slf4j;
9074
91-
@Slf4j
92-
class A {
75+
@Slf4j
76+
class A {
9377
94-
void test() {
95-
log.info("test");
96-
}
78+
void test() {
79+
log.info("test");
9780
}
98-
"""
99-
)
100-
);
101-
}
81+
}
82+
"""
83+
)
84+
);
10285
}
10386

10487
@Test

0 commit comments

Comments
 (0)