Skip to content

Commit

Permalink
Inline CompilationTestHelpers with additional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Jan 6, 2023
1 parent feb9abf commit 5989b6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {",
Expand Down

0 comments on commit 5989b6b

Please sign in to comment.