public abstract class CheckerFrameworkTest extends Object
@Parameters public static String [] getTestDirs()
getTestDir must return an array of directories that exist in the test folder, e.g.
@Parameters
public static String [] getTestDirs() {
return new String[]{"all-systems", "flow"};
}
The directories can contain more path information (e.g.,
"myTestDir/moreTests") but note, the test suite will find all of the Java
test files that exists below the listed directories. It is unnecessary
to list child directories of a directory you have already listed. @Parameters public static List<File> getTestFiles()
The method returns a List of Java files. There are methods like
TestUtilities.findNestedJavaTestFiles(java.lang.String...) to help you construct this
List. The TestSuite will then instantiate the subclass once for each
file returned by getTestFiles and execute the run method.
An example of this method is:
@Parameters
public static List<File> getTestFiles() {
return TestUtilities.findNestedJavaTestFiles("aggregate");
}
| Modifier and Type | Field and Description |
|---|---|
protected String |
checkerDir
The path, relative to currentDir/test to the directory containing test inputs.
|
protected String |
checkerName
The fully-qualified class name of the checker to use for tests.
|
protected List<String> |
checkerOptions
Extra options to pass to javac when running the checker.
|
protected File |
testFile |
| Constructor and Description |
|---|
CheckerFrameworkTest(File testFile,
Class<? extends AbstractProcessor> checker,
String checkerDir,
String... checkerOptions)
Creates a new checker test.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
customizeOptions(List<String> previousOptions)
Override this method if you would like to supply a checker
command-line option that depends on the Java file passed to the test.
|
void |
run() |
protected final File testFile
protected final String checkerName
protected final String checkerDir
public CheckerFrameworkTest(File testFile, Class<? extends AbstractProcessor> checker, String checkerDir, String... checkerOptions)
checker - the class for the checker to usecheckerDir - the path to the directory of test inputscheckerOptions - options to pass to the compiler when running testspublic void run()
public List<String> customizeOptions(List<String> previousOptions)
testFile.
If you want to specify the same command-line option for all tests of
a particular checker, then pass it to the CheckerFrameworkTest(java.io.File, java.lang.Class<? extends javax.annotation.processing.AbstractProcessor>, java.lang.String, java.lang.String...)
constructor.
previousOptions - The options specified in the constructor of the test
previousOptions is unmodifiable