From 5989b6bc7c67d57ae52532cec0c2408942ff4bb0 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Wed, 4 Jan 2023 11:18:18 +0100 Subject: [PATCH] Inline `CompilationTestHelper`s with additional arguments --- ...exicographicalAnnotationAttributeListingTest.java | 12 +++++------- .../errorprone/bugpatterns/RequestParamTypeTest.java | 8 +++----- .../errorprone/refaster/runner/RefasterTest.java | 8 +++----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListingTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListingTest.java index b7a204c457e..74a80cb8e3b 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListingTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListingTest.java @@ -10,12 +10,6 @@ final class LexicographicalAnnotationAttributeListingTest { private final CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance( LexicographicalAnnotationAttributeListing.class, getClass()); - private final CompilationTestHelper restrictedCompilationTestHelper = - CompilationTestHelper.newInstance(LexicographicalAnnotationAttributeListing.class, getClass()) - .setArgs( - ImmutableList.of( - "-XepOpt:LexicographicalAnnotationAttributeListing:Includes=pkg.A.Foo,pkg.A.Bar", - "-XepOpt:LexicographicalAnnotationAttributeListing:Excludes=pkg.A.Bar#value")); private final BugCheckerRefactoringTestHelper refactoringTestHelper = BugCheckerRefactoringTestHelper.newInstance( LexicographicalAnnotationAttributeListing.class, getClass()); @@ -246,7 +240,11 @@ void replacement() { @Test void filtering() { /* Some violations are not flagged because they are not in- or excluded. */ - restrictedCompilationTestHelper + CompilationTestHelper.newInstance(LexicographicalAnnotationAttributeListing.class, getClass()) + .setArgs( + ImmutableList.of( + "-XepOpt:LexicographicalAnnotationAttributeListing:Includes=pkg.A.Foo,pkg.A.Bar", + "-XepOpt:LexicographicalAnnotationAttributeListing:Excludes=pkg.A.Bar#value")) .addSourceLines( "pkg/A.java", "package pkg;", diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestParamTypeTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestParamTypeTest.java index 97b4c3cc4bf..eb9d6193bde 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestParamTypeTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestParamTypeTest.java @@ -6,10 +6,6 @@ final class RequestParamTypeTest { private final CompilationTestHelper compilationTestHelper = CompilationTestHelper.newInstance(RequestParamType.class, getClass()); - private final CompilationTestHelper restrictedCompilationTestHelper = - CompilationTestHelper.newInstance(RequestParamType.class, getClass()) - .setArgs( - "-XepOpt:RequestParamType:SupportedCustomTypes=com.google.common.collect.ImmutableSet,com.google.common.collect.ImmutableSortedMultiset"); @Test void identification() { @@ -70,7 +66,9 @@ void identification() { @Test void identificationRestricted() { - restrictedCompilationTestHelper + CompilationTestHelper.newInstance(RequestParamType.class, getClass()) + .setArgs( + "-XepOpt:RequestParamType:SupportedCustomTypes=com.google.common.collect.ImmutableSet,com.google.common.collect.ImmutableSortedMultiset") .addSourceLines( "A.java", "import com.google.common.collect.ImmutableBiMap;", diff --git a/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java b/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java index 8ec4e5122ce..6d2991bdf3b 100644 --- a/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java +++ b/refaster-runner/src/test/java/tech/picnic/errorprone/refaster/runner/RefasterTest.java @@ -52,10 +52,6 @@ final class RefasterTest { + "\\(see https://example.com/custom\\)")); private final BugCheckerRefactoringTestHelper refactoringTestHelper = BugCheckerRefactoringTestHelper.newInstance(Refaster.class, getClass()); - private final BugCheckerRefactoringTestHelper restrictedRefactoringTestHelper = - BugCheckerRefactoringTestHelper.newInstance(Refaster.class, getClass()) - .setArgs( - "-XepOpt:Refaster:NamePattern=.*\\$(StringOfSizeZeroVerboseRule|StringOfSizeTwoRule)$"); @Test void identification() { @@ -246,7 +242,9 @@ void replacement() { @Test void restrictedReplacement() { - restrictedRefactoringTestHelper + BugCheckerRefactoringTestHelper.newInstance(Refaster.class, getClass()) + .setArgs( + "-XepOpt:Refaster:NamePattern=.*\\$(StringOfSizeZeroVerboseRule|StringOfSizeTwoRule)$") .addInputLines( "A.java", "class A {",