Class CheckerFrameworkPerDirectoryTest
- Direct Known Subclasses:
- CheckerFrameworkWPIPerDirectoryTest
CheckerFrameworkPerFileTest to
 compile each test file in a test directory individually. A CheckerFrameworkPerDirectoryTest is faster than an equivalent CheckerFrameworkPerFileTest, but can only test that processor errors or warnings are issued.
 To create a CheckerFrameworkPerDirectoryTest, create a new class that extends this
 class. The new class must do the following:
 
- Declare a constructor taking 1 parameter of type java.util.List<java.io.File>. This is a list of the files that will be compiled.
- Declare the following method:
       @Parameters public static String [] getTestDirs()getTestDir must return an array of directories that exist in the test folder. 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. 
 public class MyTest extends CheckerFrameworkPerDirectoryTest {
   /** @param testFiles the files containing test code, which will be type-checked */
   public MyTest(List<File> testFiles) {
     super(testFiles, MyChecker.class, "", "Anomsgtext");
   }
  @Parameters
   public static String [] getTestDirs() {
     return new String[]{"all-systems"};
   }
 }
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final List<@BinaryName String>The binary names of the checkers to run.Extra options to pass to javac when running the checker.Extra entries for the classpath.protected final StringThe path, relative to currentDir/test to the directory containing test inputs.The files containing test code, which will be type-checked.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCheckerFrameworkPerDirectoryTest(List<File> testFiles, Class<? extends AbstractProcessor> checker, String testDir, String... checkerOptions) Creates a new checker test.protectedCheckerFrameworkPerDirectoryTest(List<File> testFiles, Class<? extends AbstractProcessor> checker, String testDir, List<String> classpathExtra, String... checkerOptions) Creates a new checker test.protectedCheckerFrameworkPerDirectoryTest(List<File> testFiles, List<@BinaryName String> checkerNames, String testDir, List<String> classpathExtra, String... checkerOptions) Creates a new checker test.
- 
Method SummaryModifier and TypeMethodDescriptionadjustTypecheckResult(TypecheckResult testResult) This method is called before issuing assertions about a TypecheckResult.customizeOptions(List<String> previousOptions) Override this method if you would like to supply a checker command-line option that depends on the Java files passed to the test.voidrun()
- 
Field Details- 
testFilesThe files containing test code, which will be type-checked.
- 
checkerNamesThe binary names of the checkers to run.
- 
testDirThe path, relative to currentDir/test to the directory containing test inputs.
- 
checkerOptionsExtra options to pass to javac when running the checker.
- 
classpathExtraExtra entries for the classpath.
 
- 
- 
Constructor Details- 
CheckerFrameworkPerDirectoryTestprotected CheckerFrameworkPerDirectoryTest(List<File> testFiles, Class<? extends AbstractProcessor> checker, String testDir, String... checkerOptions) Creates a new checker test.TestConfigurationBuilder.getDefaultConfigurationBuilder(String, File, String, Iterable, Iterable, List, boolean)adds additional checker options.- Parameters:
- testFiles- the files containing test code, which will be type-checked
- checker- the class for the checker to use
- testDir- the path to the directory of test inputs
- checkerOptions- options to pass to the compiler when running tests
 
- 
CheckerFrameworkPerDirectoryTestprotected CheckerFrameworkPerDirectoryTest(List<File> testFiles, Class<? extends AbstractProcessor> checker, String testDir, List<String> classpathExtra, String... checkerOptions) Creates a new checker test.TestConfigurationBuilder.getDefaultConfigurationBuilder(String, File, String, Iterable, Iterable, List, boolean)adds additional checker options.- Parameters:
- testFiles- the files containing test code, which will be type-checked
- checker- the class for the checker to use
- testDir- the path to the directory of test inputs
- classpathExtra- extra entries for the classpath, relative to a directory such as checker-framework/checker
- checkerOptions- options to pass to the compiler when running tests
 
- 
CheckerFrameworkPerDirectoryTestprotected CheckerFrameworkPerDirectoryTest(List<File> testFiles, List<@BinaryName String> checkerNames, String testDir, List<String> classpathExtra, String... checkerOptions) Creates a new checker test.TestConfigurationBuilder.getDefaultConfigurationBuilder(String, File, String, Iterable, Iterable, List, boolean)adds additional checker options.- Parameters:
- testFiles- the files containing test code, which will be type-checked
- checkerNames- the binary names of the checkers to run
- testDir- the path to the directory of test inputs
- classpathExtra- extra entries for the classpath, relative to a directory such as checker-framework/checker
- checkerOptions- options to pass to the compiler when running tests
 
 
- 
- 
Method Details- 
runpublic void run()
- 
adjustTypecheckResultThis method is called before issuing assertions about a TypecheckResult. Subclasses can override it to customize behavior.- Parameters:
- testResult- a test result to possibly change
- Returns:
- a TypecheckResult to use instead, which may be the unmodified argument
 
- 
customizeOptionsOverride this method if you would like to supply a checker command-line option that depends on the Java files passed to the test. Those files are available in fieldtestFiles.If you want to specify the same command-line option for all tests of a particular checker, then pass it to the CheckerFrameworkPerDirectoryTest(java.util.List<java.io.File>, java.util.List<java.lang.String>, java.lang.String, java.util.List<java.lang.String>, java.lang.String...)constructor.- Parameters:
- previousOptions- the options specified in the constructor of the test previousOptions is unmodifiable
- Returns:
- a new list of options or the original passed through
 
 
-