File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed
src/test/java/org/openrewrite/java/migrate/lombok Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,36 @@ class A {
197197 );
198198 }
199199
200+ @ Test
201+ void replacePrivateGetterAnnotated () {
202+ rewriteRun (// language=java
203+ java (
204+ """
205+ class A {
206+
207+ int foo = 9;
208+
209+ @Deprecated
210+ private int getFoo() {
211+ return foo;
212+ }
213+ }
214+ """ ,
215+ """
216+ import lombok.AccessLevel;
217+ import lombok.Getter;
218+
219+ class A {
220+
221+ @Getter(value = AccessLevel.PRIVATE, onMethod_ = {@Deprecated})
222+ int foo = 9;
223+ }
224+ """
225+
226+ )
227+ );
228+ }
229+
200230 @ Test
201231 void replaceJustTheMatchingGetter () {
202232 rewriteRun (// language=java
@@ -542,7 +572,7 @@ class A {
542572
543573 @Deprecated
544574 @SuppressWarnings("deprecation")
545- public int getFoo() {
575+ private int getFoo() {
546576 return foo;
547577 }
548578 }
Original file line number Diff line number Diff line change @@ -232,6 +232,35 @@ class A {
232232 );
233233 }
234234
235+ @ Test
236+ void replacePrivateSetterAnnotated () {
237+ rewriteRun (// language=java
238+ java (
239+ """
240+ class A {
241+
242+ int foo = 9;
243+
244+ @Deprecated
245+ private void setFoo(int foo) {
246+ this.foo = foo;
247+ }
248+ }
249+ """ ,
250+ """
251+ import lombok.AccessLevel;
252+ import lombok.Setter;
253+
254+ class A {
255+
256+ @Setter(value = AccessLevel.PRIVATE, onMethod_ = {@Deprecated})
257+ int foo = 9;
258+ }
259+ """
260+ )
261+ );
262+ }
263+
235264 @ Test
236265 void replaceJustTheMatchingSetter () {
237266 rewriteRun (// language=java
You can’t perform that action at this time.
0 commit comments