public class TestConfigurationBuilder
extends java.lang.Object
new TestConfigurationBuilder() .addOption("-Awarns") .addSourceFile("src1.java")
.addDiagnosticFile("src1.out")
TestConfiguration
Modifier and Type | Field and Description |
---|---|
static java.lang.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 optoins in initialConfig
|
Modifier and Type | Method and Description |
---|---|
TestConfigurationBuilder |
addDiagnosticFile(java.io.File diagnostics) |
TestConfigurationBuilder |
addDiagnosticFiles(java.lang.Iterable<java.io.File> diagnostics) |
TestConfigurationBuilder |
adddToPathOption(java.lang.String key,
java.lang.String toAppend) |
TestConfigurationBuilder |
addOption(java.lang.String option) |
TestConfigurationBuilder |
addOption(java.lang.String option,
java.lang.String value) |
TestConfigurationBuilder |
addOptionIfValueNonEmpty(java.lang.String option,
java.lang.String value) |
TestConfigurationBuilder |
addOptions(java.lang.Iterable<java.lang.String> newOptions) |
TestConfigurationBuilder |
addOptions(java.util.Map<java.lang.String,java.lang.String> options) |
TestConfigurationBuilder |
addProcessor(java.lang.String processor) |
TestConfigurationBuilder |
addProcessors(java.lang.Iterable<java.lang.String> processors) |
TestConfigurationBuilder |
addSourceFile(java.io.File sourceFile) |
TestConfigurationBuilder |
addSourceFiles(java.lang.Iterable<java.io.File> sourceFiles) |
TestConfiguration |
build()
Creates a TestConfiguration using the settings in this builder.
|
static TestConfiguration |
buildDefaultConfiguration(java.lang.String testSourcePath,
java.io.File testFile,
java.lang.String checkerName,
java.util.List<java.lang.String> options,
boolean shouldEmitDebugInfo)
This is the default configuration used by Checker Framework JUnit tests.
|
static TestConfiguration |
buildDefaultConfiguration(java.lang.String testSourcePath,
java.lang.Iterable<java.io.File> testSourceFiles,
java.lang.Iterable<java.lang.String> processors,
java.util.List<java.lang.String> options,
boolean shouldEmitDebugInfo)
This is the default configuration used by Checker Framework JUnit tests.
|
TestConfigurationBuilder |
dontEmitDebugInfo() |
TestConfigurationBuilder |
emitDebugInfo() |
java.util.List<java.lang.String> |
flatOptions() |
static java.lang.String |
getDefaultClassPath() |
static TestConfigurationBuilder |
getDefaultConfigurationBuilder(java.lang.String testSourcePath,
java.io.File outputClassDirectory,
java.lang.String classPath,
java.lang.Iterable<java.io.File> testSourceFiles,
java.lang.Iterable<java.lang.String> processors,
java.util.List<java.lang.String> options,
boolean shouldEmitDebugInfo)
This creates a builder for the default configuration used by Checker Framework JUnit tests.
|
static java.lang.String |
getJdkJarPathFromProperty()
Uses the system property "JDK_JAR" to find the annotated JDK
|
static java.io.File |
getOutputDirFromProperty() |
TestConfigurationBuilder |
setDiagnosticFiles(java.util.List<java.io.File> diagnosticFiles) |
TestConfigurationBuilder |
setOptions(java.util.Map<java.lang.String,java.lang.String> options) |
TestConfigurationBuilder |
setProcessors(java.lang.Iterable<java.lang.String> processors) |
TestConfigurationBuilder |
setShouldEmitDebugInfo(boolean shouldEmitDebugInfo) |
TestConfigurationBuilder |
setSourceFiles(java.util.List<java.io.File> sourceFiles) |
java.lang.String |
toString() |
java.util.List<java.lang.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 java.lang.String TESTS_OUTPUTDIR
public TestConfigurationBuilder()
public TestConfigurationBuilder(TestConfiguration initialConfig)
public static TestConfigurationBuilder getDefaultConfigurationBuilder(java.lang.String testSourcePath, java.io.File outputClassDirectory, java.lang.String classPath, java.lang.Iterable<java.io.File> testSourceFiles, java.lang.Iterable<java.lang.String> processors, java.util.List<java.lang.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(java.lang.String testSourcePath, java.lang.Iterable<java.io.File> testSourceFiles, java.lang.Iterable<java.lang.String> processors, java.util.List<java.lang.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(java.lang.String testSourcePath, java.io.File testFile, java.lang.String checkerName, java.util.List<java.lang.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 compilecheckerName
- a single Checker to include in the processors fieldoptions
- the options to the compiler/processorsshouldEmitDebugInfo
- whether or not debug information should be emittedpublic java.util.List<java.lang.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(java.lang.String key, java.lang.String toAppend)
public TestConfigurationBuilder addDiagnosticFile(java.io.File diagnostics)
public TestConfigurationBuilder addDiagnosticFiles(java.lang.Iterable<java.io.File> diagnostics)
public TestConfigurationBuilder setDiagnosticFiles(java.util.List<java.io.File> diagnosticFiles)
public TestConfigurationBuilder addSourceFile(java.io.File sourceFile)
public TestConfigurationBuilder addSourceFiles(java.lang.Iterable<java.io.File> sourceFiles)
public TestConfigurationBuilder setSourceFiles(java.util.List<java.io.File> sourceFiles)
public TestConfigurationBuilder setOptions(java.util.Map<java.lang.String,java.lang.String> options)
public TestConfigurationBuilder addOption(java.lang.String option)
public TestConfigurationBuilder addOption(java.lang.String option, java.lang.String value)
public TestConfigurationBuilder addOptionIfValueNonEmpty(java.lang.String option, java.lang.String value)
public TestConfigurationBuilder addOptions(java.util.Map<java.lang.String,java.lang.String> options)
public TestConfigurationBuilder addOptions(java.lang.Iterable<java.lang.String> newOptions)
public TestConfigurationBuilder setProcessors(java.lang.Iterable<java.lang.String> processors)
public TestConfigurationBuilder addProcessor(java.lang.String processor)
public TestConfigurationBuilder addProcessors(java.lang.Iterable<java.lang.String> processors)
public 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 java.util.List<java.lang.String> flatOptions()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.io.File getOutputDirFromProperty()
public static java.lang.String getDefaultClassPath()
public static java.lang.String getJdkJarPathFromProperty()