Class BugCheckerRefactoringTestHelper
java.lang.Object
com.google.errorprone.BugCheckerRefactoringTestHelper
Compare a file transformed as suggested by
BugChecker
to an expected source.
Inputs are a BugChecker
instance, input file and expected file.
- Author:
- kurs@google.com (Jan Kurs)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
To assert the proper.addInput().addOutput()
chain.static interface
For checks that provide multiple possible fixes, chooses the one that will be applied for the test.static enum
Predefined FixChoosers for selecting a fix by its position in the liststatic enum
Test mode for matching refactored source against expected source. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.addInputLines
(String path, String... input) addModules
(String... modules) If set, fixes that produce output that doesn't compile are allowed.void
doTest()
void
newInstance
(BugChecker refactoringBugChecker, Class<?> clazz) Deprecated.prefernewInstance(Class, Class)
newInstance
(ScannerSupplier scannerSupplier, Class<?> clazz) Returns a newCompilationTestHelper
.newInstance
(Class<? extends BugChecker> checkerClass, Class<?> clazz) setImportOrder
(String importOrder)
-
Method Details
-
newInstance
@Deprecated public static BugCheckerRefactoringTestHelper newInstance(BugChecker refactoringBugChecker, Class<?> clazz) Deprecated.prefernewInstance(Class, Class)
-
newInstance
public static BugCheckerRefactoringTestHelper newInstance(ScannerSupplier scannerSupplier, Class<?> clazz) Returns a newCompilationTestHelper
.- Parameters:
scannerSupplier
- theScannerSupplier
to testclazz
- the class to use to locate file resources
-
newInstance
public static BugCheckerRefactoringTestHelper newInstance(Class<? extends BugChecker> checkerClass, Class<?> clazz) -
addInput
Deprecated.preferaddInputLines(String, String...)
. Declaring tests in the same file using text blocks is more readable, as it encourages writing small, focussed tests.Adds an input file. -
addInputLines
-
setFixChooser
@CanIgnoreReturnValue public BugCheckerRefactoringTestHelper setFixChooser(BugCheckerRefactoringTestHelper.FixChooser chooser) -
addModules
-
setArgs
@CanIgnoreReturnValue public BugCheckerRefactoringTestHelper setArgs(com.google.common.collect.ImmutableList<String> args) -
setArgs
-
allowBreakingChanges
If set, fixes that produce output that doesn't compile are allowed. Off by default. -
setImportOrder
-
doTest
public void doTest() -
doTest
-
addInputLines(String, String...)
.