Skip to content

Commit a602b44

Browse files
OpenRewrite recipe best practices
Use this link to re-run the recipe: https://app.moderne.io/builder/abtSSjvHK?organizationId=QUxML01vZGVybmUgKyBPcGVuUmV3cml0ZQ%3D%3D Co-authored-by: Moderne <team@moderne.io>
1 parent ff368ff commit a602b44

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

src/main/java/org/openrewrite/java/testing/assertj/MigrateAssertionsForClassTypes.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.openrewrite.java.testing.assertj;
1717

18+
import lombok.Getter;
1819
import org.openrewrite.ExecutionContext;
1920
import org.openrewrite.Preconditions;
2021
import org.openrewrite.Recipe;
@@ -61,18 +62,14 @@ public class MigrateAssertionsForClassTypes extends Recipe {
6162
"org.assertj.core.api.AssertDelegateTarget"
6263
);
6364

64-
@Override
65-
public String getDisplayName() {
66-
return "Use `Assertions.assertThatObject` for ambiguous `AssertionsForClassTypes.assertThat` calls";
67-
}
65+
@Getter
66+
final String displayName = "Use `Assertions.assertThatObject` for ambiguous `AssertionsForClassTypes.assertThat` calls";
6867

69-
@Override
70-
public String getDescription() {
71-
return "The deprecated `AssertionsForClassTypes.assertThat(T)` always returns an `ObjectAssert`, while the " +
72-
"unified `Assertions.assertThat` additionally offers more specific overloads (e.g. for `Iterable`, " +
73-
"`Map`, `Predicate`). For arguments matching those overloads, rename `assertThat` to `assertThatObject` " +
74-
"so that migrating to `Assertions` keeps returning an `ObjectAssert` and the code keeps compiling.";
75-
}
68+
@Getter
69+
final String description = "The deprecated `AssertionsForClassTypes.assertThat(T)` always returns an `ObjectAssert`, while the " +
70+
"unified `Assertions.assertThat` additionally offers more specific overloads (e.g. for `Iterable`, " +
71+
"`Map`, `Predicate`). For arguments matching those overloads, rename `assertThat` to `assertThatObject` " +
72+
"so that migrating to `Assertions` keeps returning an `ObjectAssert` and the code keeps compiling.";
7673

7774
@Override
7875
public TreeVisitor<?, ExecutionContext> getVisitor() {

0 commit comments

Comments
 (0)