From b514375a4b01bb4ac38fbe88c9e10f9c8c6ac2ba Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Thu, 13 Apr 2023 13:24:21 +0200 Subject: [PATCH 1/2] Fix and enable `SuggestedFixRules` tests --- .../errorprone/refasterrules/RefasterRulesTest.java | 5 +++-- .../refasterrules/SuggestedFixRulesTestOutput.java | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/refasterrules/RefasterRulesTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/refasterrules/RefasterRulesTest.java index d1b461536c..0dc5d22049 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/refasterrules/RefasterRulesTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/refasterrules/RefasterRulesTest.java @@ -13,7 +13,6 @@ final class RefasterRulesTest { /** The names of all Refaster rule groups defined in this module. */ private static final ImmutableSet> RULE_COLLECTIONS = ImmutableSet.of( - AssertJRules.class, AssertJBigDecimalRules.class, AssertJBigIntegerRules.class, AssertJBooleanRules.class, @@ -25,11 +24,12 @@ final class RefasterRulesTest { AssertJFloatRules.class, AssertJIntegerRules.class, AssertJLongRules.class, - AssertJNumberRules.class, AssertJMapRules.class, + AssertJNumberRules.class, AssertJObjectRules.class, AssertJOptionalRules.class, AssertJPrimitiveRules.class, + AssertJRules.class, AssertJShortRules.class, AssertJStringRules.class, AssertJThrowingCallableRules.class, @@ -65,6 +65,7 @@ final class RefasterRulesTest { RxJava2AdapterRules.class, StreamRules.class, StringRules.class, + SuggestedFixRules.class, TestNGToAssertJRules.class, TimeRules.class, WebClientRules.class); diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java index e49929b52e..5baba4b4ef 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java @@ -11,26 +11,26 @@ SuggestedFix testSuggestedFixDelete() { } SuggestedFix testSuggestedFixReplaceTree() { - return Suggestions.replace(null, "foo"); + return SuggestedFix.replace(null, "foo"); } SuggestedFix testSuggestedFixReplaceStartEnd() { - return Suggestions.replace(1, 2, "foo"); + return SuggestedFix.replace(1, 2, "foo"); } SuggestedFix testSuggestedFixReplaceTreeStartEnd() { - return Suggestions.replace(null, "foo", 1, 2); + return SuggestedFix.replace(null, "foo", 1, 2); } SuggestedFix testSuggestedFixSwap() { - return Suggestions.swap((Tree) null, (ExpressionTree) null); + return SuggestedFix.swap((Tree) null, (ExpressionTree) null); } SuggestedFix testSuggestedFixPrefixWith() { - return Suggestions.prefixWith(null, "foo"); + return SuggestedFix.prefixWith(null, "foo"); } SuggestedFix testSuggestedFixPostfixWith() { - return Suggestions.postfixWith(null, "foo"); + return SuggestedFix.postfixWith(null, "foo"); } } From 730109a9a96a1b57d53f9774dcc72675dd71dcac Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Thu, 13 Apr 2023 13:29:29 +0200 Subject: [PATCH 2/2] Man man man --- .../errorprone/refasterrules/SuggestedFixRulesTestInput.java | 3 ++- .../errorprone/refasterrules/SuggestedFixRulesTestOutput.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java index 5641bb0c2e..4d6c7ccdc5 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestInput.java @@ -1,10 +1,11 @@ package tech.picnic.errorprone.refasterrules; +import com.google.errorprone.fixes.SuggestedFix; import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.Tree; import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase; -final class SuggestFixRulesTest implements RefasterRuleCollectionTestCase { +final class SuggestedFixRulesTest implements RefasterRuleCollectionTestCase { SuggestedFix testSuggestedFixDelete() { return SuggestedFix.builder().delete(null).build(); } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java index 5baba4b4ef..15671e43d4 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/SuggestedFixRulesTestOutput.java @@ -5,7 +5,7 @@ import com.sun.source.tree.Tree; import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase; -final class SuggestFixRulesTest implements RefasterRuleCollectionTestCase { +final class SuggestedFixRulesTest implements RefasterRuleCollectionTestCase { SuggestedFix testSuggestedFixDelete() { return SuggestedFix.delete(null); }