public class TestConfigurationBuilder extends Object
new TestConfigurationBuilder() .addOption("-Awarns") .addSourceFile("src1.java")
.addDiagnosticFile("src1.out")
TestConfiguration
Modifier and Type | Field and Description |
---|---|
static String |
TESTS_OUTPUTDIR |
Constructor and Description |
---|
TestConfigurationBuilder()
Note: There are static helper methods named buildConfiguration and buildConfigurationBuilder
that can be used to create the most common types of configurations
|
TestConfigurationBuilder(TestConfiguration initialConfig)
Create a builder that has all of the options in initialConfig.
|
Modifier and Type | Method and Description |
---|---|
TestConfigurationBuilder |
addDiagnosticFile(File diagnostics) |
TestConfigurationBuilder |
addDiagnosticFiles(Iterable<File> diagnostics) |
TestConfigurationBuilder |
adddToPathOption(String key,
String toAppend) |
TestConfigurationBuilder |
addOption(String option) |
TestConfigurationBuilder |
addOption(String option,
String value) |
TestConfigurationBuilder |
addOptionIfValueNonEmpty(String option,
String value) |
TestConfigurationBuilder |
addOptions(Iterable<String> newOptions) |
TestConfigurationBuilder |
addOptions(Map<String,String> options)
Adds the given options to this.
|
TestConfigurationBuilder |
addProcessor(@BinaryName String processor)
Add a processor.
|
TestConfigurationBuilder |
addProcessors(Iterable<String> processors)
Add processors.
|
TestConfigurationBuilder |
addSourceFile(File sourceFile) |
TestConfigurationBuilder |
addSourceFiles(Iterable<File> sourceFiles) |
TestConfiguration |
build()
Creates a TestConfiguration using the settings in this builder.
|
static TestConfiguration |
buildDefaultConfiguration(String testSourcePath,
File testFile,
Class<?> processor,
List<String> options,
boolean shouldEmitDebugInfo)
This is the default configuration used by Checker Framework JUnit tests.
|
static TestConfiguration |
buildDefaultConfiguration(String testSourcePath,
Iterable<File> testSourceFiles,
Collection<String> classpathExtra,
Iterable<String> processors,
List<String> options,
boolean shouldEmitDebugInfo)
This is the default configuration used by Checker Framework JUnit tests.
|
static TestConfiguration |
buildDefaultConfiguration(String testSourcePath,
Iterable<File> testSourceFiles,
Iterable<String> processors,
List<String> options,
boolean shouldEmitDebugInfo)
This is the default configuration used by Checker Framework JUnit tests.
|
TestConfigurationBuilder |
dontEmitDebugInfo() |
TestConfigurationBuilder |
emitDebugInfo() |
List<String> |
flatOptions()
Returns the set of Javac options as a flat list.
|
static String |
getDefaultClassPath() |
static TestConfigurationBuilder |
getDefaultConfigurationBuilder(String testSourcePath,
File outputClassDirectory,
String classPath,
Iterable<File> testSourceFiles,
Iterable<String> processors,
List<String> options,
boolean shouldEmitDebugInfo)
This creates a builder for the default configuration used by Checker Framework JUnit tests.
|
static File |
getOutputDirFromProperty() |
TestConfigurationBuilder |
setDiagnosticFiles(List<File> diagnosticFiles) |
TestConfigurationBuilder |
setOptions(Map<String,String> options) |
TestConfigurationBuilder |
setProcessors(Iterable<String> processors)
Set the processors.
|
TestConfigurationBuilder |
setShouldEmitDebugInfo(boolean shouldEmitDebugInfo) |
TestConfigurationBuilder |
setSourceFiles(List<File> sourceFiles) |
String |
toString() |
List<String> |
validate(boolean requireProcessors)
Ensures that the minimum requirements for running a test are met.
|
TestConfiguration |
validateThenBuild(boolean requireProcessors)
Creates a TestConfiguration using the settings in this builder.
|
public static final String TESTS_OUTPUTDIR
public TestConfigurationBuilder()
public TestConfigurationBuilder(TestConfiguration initialConfig)
initialConfig
- initial configuration for the newly-created builderpublic static TestConfigurationBuilder getDefaultConfigurationBuilder(String testSourcePath, File outputClassDirectory, String classPath, Iterable<File> testSourceFiles, Iterable<String> processors, List<String> options, boolean shouldEmitDebugInfo)
testSourcePath
- the path to the Checker test file sources, usually this is the directory
of Checker's testsoutputClassDirectory
- the directory to place classes compiled for testingclassPath
- the classpath to use for compilationtestSourceFiles
- the Java files that compose the testprocessors
- the checkers or other annotation processors to run over the testSourceFilesoptions
- the options to the compiler/processorsshouldEmitDebugInfo
- whether or not debug information should be emittedpublic static TestConfiguration buildDefaultConfiguration(String testSourcePath, File testFile, Class<?> processor, List<String> options, boolean shouldEmitDebugInfo)
testSourcePath
- the path to the Checker test file sources, usually this is the directory
of Checker's teststestFile
- a single test Java file to compileprocessor
- a single checker to include in the processors fieldoptions
- the options to the compiler/processorsshouldEmitDebugInfo
- whether or not debug information should be emittedpublic static TestConfiguration buildDefaultConfiguration(String testSourcePath, Iterable<File> testSourceFiles, Iterable<String> processors, List<String> options, boolean shouldEmitDebugInfo)
testSourcePath
- the path to the Checker test file sources, usually this is the directory
of Checker's teststestSourceFiles
- the Java files that compose the testprocessors
- the checkers or other annotation processors to run over the testSourceFilesoptions
- the options to the compiler/processorsshouldEmitDebugInfo
- whether or not debug information should be emittedpublic static TestConfiguration buildDefaultConfiguration(String testSourcePath, Iterable<File> testSourceFiles, Collection<String> classpathExtra, Iterable<String> processors, List<String> options, boolean shouldEmitDebugInfo)
testSourcePath
- the path to the Checker test file sources, usually this is the directory
of Checker's teststestSourceFiles
- the Java files that compose the testclasspathExtra
- extra entries for the classpath, needed to compile the source filesprocessors
- the checkers or other annotation processors to run over the testSourceFilesoptions
- the options to the compiler/processorsshouldEmitDebugInfo
- whether or not debug information should be emittedpublic List<String> validate(boolean requireProcessors)
-processor
option in the optionMap (it should be added by
addProcessor instead)
requireProcessors
- whether or not to require that there is at least one processorpublic TestConfigurationBuilder adddToPathOption(String key, String toAppend)
public TestConfigurationBuilder addDiagnosticFile(File diagnostics)
public TestConfigurationBuilder addDiagnosticFiles(Iterable<File> diagnostics)
public TestConfigurationBuilder setDiagnosticFiles(List<File> diagnosticFiles)
public TestConfigurationBuilder addSourceFile(File sourceFile)
public TestConfigurationBuilder addSourceFiles(Iterable<File> sourceFiles)
public TestConfigurationBuilder setSourceFiles(List<File> sourceFiles)
public TestConfigurationBuilder setOptions(Map<String,String> options)
public TestConfigurationBuilder addOption(String option)
public TestConfigurationBuilder addOption(String option, String value)
public TestConfigurationBuilder addOptionIfValueNonEmpty(String option, String value)
@RequiresNonNull(value="this.options") public TestConfigurationBuilder addOptions(@UnknownInitialization(value=TestConfigurationBuilder.class) TestConfigurationBuilder this, Map<String,String> options)
options
- options to add to thispublic TestConfigurationBuilder addOptions(Iterable<String> newOptions)
public TestConfigurationBuilder setProcessors(Iterable<String> processors)
processors
- the processors to runpublic TestConfigurationBuilder addProcessor(@BinaryName String processor)
processor
- a processor to runpublic TestConfigurationBuilder addProcessors(Iterable<String> processors)
processors
- processors to runpublic TestConfigurationBuilder emitDebugInfo()
public TestConfigurationBuilder dontEmitDebugInfo()
public TestConfigurationBuilder setShouldEmitDebugInfo(boolean shouldEmitDebugInfo)
public TestConfiguration build()
public TestConfiguration validateThenBuild(boolean requireProcessors)
requireProcessors
- whether or not there should be at least 1 processor specified, see
method validatepublic List<String> flatOptions()
public static File getOutputDirFromProperty()
public static String getDefaultClassPath()