Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Jan 6, 2023
1 parent 6be6585 commit d64afa2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tech.picnic.errorprone.bugpatterns;

import static com.google.errorprone.BugCheckerRefactoringTestHelper.newInstance;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers;
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
Expand Down Expand Up @@ -67,7 +66,7 @@ void identification() {

@Test
void replacementFirstSuggestedFix() {
newInstance(FluxFlatMapUsage.class, getClass())
BugCheckerRefactoringTestHelper.newInstance(FluxFlatMapUsage.class, getClass())
.setFixChooser(FixChoosers.FIRST)
.addInputLines(
"A.java",
Expand Down Expand Up @@ -102,7 +101,7 @@ void replacementFirstSuggestedFix() {

@Test
void replacementSecondSuggestedFix() {
newInstance(FluxFlatMapUsage.class, getClass())
BugCheckerRefactoringTestHelper.newInstance(FluxFlatMapUsage.class, getClass())
.setFixChooser(FixChoosers.SECOND)
.addInputLines(
"A.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// XXX: Can we perhaps work-around this by describing the fixes in reverse order?
final class PrimitiveComparisonTest {
/**
* @implNote The logic for `char` and `short` is exactly analogous to the `byte` case.
* @implNote The logic for {@code char} and {@code short} is exactly analogous to the {@code byte}
* case.
*/
@Test
void byteComparison() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
final class RedundantStringConversionTest {
private final CompilationTestHelper compilationTestHelper =
CompilationTestHelper.newInstance(RedundantStringConversion.class, getClass());
private final CompilationTestHelper customizedCompilationTestHelper =
CompilationTestHelper.newInstance(RedundantStringConversion.class, getClass())
.setArgs(
ImmutableList.of(
"-XepOpt:RedundantStringConversion:ExtraConversionMethods=java.lang.Enum#name(),A#name(),A.B#toString(int)"));
private final BugCheckerRefactoringTestHelper refactoringTestHelper =
BugCheckerRefactoringTestHelper.newInstance(RedundantStringConversion.class, getClass());

@Test
void identificationOfIdentityTransformation() {
Expand Down Expand Up @@ -416,7 +409,10 @@ void identificationWithinSlf4jLoggerMethod() {

@Test
void identificationOfCustomConversionMethod() {
customizedCompilationTestHelper
CompilationTestHelper.newInstance(RedundantStringConversion.class, getClass())
.setArgs(
ImmutableList.of(
"-XepOpt:RedundantStringConversion:ExtraConversionMethods=java.lang.Enum#name(),A#name(),A.B#toString(int)"))
.addSourceLines(
"A.java",
"import java.math.RoundingMode;",
Expand Down Expand Up @@ -509,7 +505,7 @@ void identificationOfCustomConversionMethod() {

@Test
void replacement() {
refactoringTestHelper
BugCheckerRefactoringTestHelper.newInstance(RedundantStringConversion.class, getClass())
.addInputLines(
"A.java",
"class A {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ final class RefasterTest {
"\\[Refaster Rule\\] FooRules\\.ExtraGrouping\\.StringOfSizeThreeRule: "
+ "A custom description about matching three-char strings\\s+.+\\s+"
+ "\\(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 @@ -220,7 +214,7 @@ private static SeverityLevel toSeverityLevel(String compilerDiagnosticsPrefix) {

@Test
void replacement() {
refactoringTestHelper
BugCheckerRefactoringTestHelper.newInstance(Refaster.class, getClass())
.addInputLines(
"A.java",
"class A {",
Expand All @@ -246,7 +240,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 d64afa2

Please sign in to comment.