public class TestUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
isAtLeast8Jvm |
static boolean |
isJSR308Compiler |
Constructor and Description |
---|
TestUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
assertResultsAreValid(TypecheckResult testResult)
TODO: REDO COMMENT Compares the result of the compiler against an array of Strings.
|
static java.util.List<java.io.File> |
deeplyEnclosedJavaTestFiles(java.io.File directory)
Returns all the java files that are descendants of the given directory
|
static java.util.Set<java.lang.String> |
diagnosticsToStrings(java.lang.Iterable<javax.tools.Diagnostic<? extends javax.tools.JavaFileObject>> actualDiagnostics,
boolean usingAnomsgtxt) |
static java.lang.String |
diagnosticToString(javax.tools.Diagnostic<? extends javax.tools.JavaFileObject> diagnostic,
boolean usingAnomsgtxt) |
static void |
ensureDirectoryExists(java.io.File path) |
static java.io.File |
findComparisonFile(java.io.File testFile) |
static java.util.List<java.lang.Object[]> |
findFilesInParent(java.io.File parent,
java.lang.String... fileNames) |
static java.util.List<java.util.List<java.io.File>> |
findJavaFilesPerDirectory(java.io.File parent,
java.lang.String... dirNames)
Returns a list where each item is a list of Java files, excluding any skip tests, for each
directory given by dirName and also a list for any subdirectory.
|
static java.util.List<java.io.File> |
findNestedJavaTestFiles(java.lang.String... dirNames) |
static java.util.List<java.io.File> |
findRelativeNestedJavaFiles(java.io.File parent,
java.lang.String... dirNames) |
static java.util.List<java.io.File> |
findRelativeNestedJavaFiles(java.lang.String parent,
java.lang.String... dirNames) |
static java.util.List<java.io.File> |
getJavaFilesAsArgumentList(java.io.File... dirs)
Traverses the directories listed looking for java test files
|
static boolean |
getShouldEmitDebugInfo() |
static java.io.File |
getTestFile(java.lang.String fileRelativeToTestsDir) |
static boolean |
isJavaFile(java.io.File file) |
static boolean |
isJavaTestFile(java.io.File file) |
static java.util.List<java.lang.String> |
optionMapToList(java.util.Map<java.lang.String,java.lang.String> options) |
static java.lang.String |
summarizeSourceFiles(java.util.List<java.io.File> javaFiles) |
static boolean |
testBooleanProperty(java.lang.String propName) |
static boolean |
testBooleanProperty(java.lang.String propName,
boolean defaultValue) |
static void |
writeDiagnostics(java.io.File file,
java.io.File testFile,
java.util.List<java.lang.String> expected,
java.util.List<java.lang.String> actual,
java.util.List<java.lang.String> unexpected,
java.util.List<java.lang.String> missing,
boolean usingNoMsgText,
boolean testFailed) |
static void |
writeJavacArguments(java.io.File file,
java.lang.Iterable<? extends javax.tools.JavaFileObject> files,
java.lang.Iterable<java.lang.String> options,
java.lang.Iterable<java.lang.String> processors) |
static void |
writeLines(java.io.File file,
java.lang.Iterable<?> lines) |
static void |
writeTestConfiguration(java.io.File file,
TestConfiguration config) |
public static final boolean isJSR308Compiler
public static final boolean isAtLeast8Jvm
public static java.util.List<java.io.File> findNestedJavaTestFiles(java.lang.String... dirNames)
public static java.util.List<java.io.File> findRelativeNestedJavaFiles(java.lang.String parent, java.lang.String... dirNames)
public static java.util.List<java.io.File> findRelativeNestedJavaFiles(java.io.File parent, java.lang.String... dirNames)
public static java.util.List<java.util.List<java.io.File>> findJavaFilesPerDirectory(java.io.File parent, java.lang.String... dirNames)
parent
- parent directory of the dirNames directoriesdirNames
- names of directories to searchpublic static java.util.List<java.lang.Object[]> findFilesInParent(java.io.File parent, java.lang.String... fileNames)
public static java.util.List<java.io.File> getJavaFilesAsArgumentList(java.io.File... dirs)
public static java.util.List<java.io.File> deeplyEnclosedJavaTestFiles(java.io.File directory)
public static boolean isJavaFile(java.io.File file)
public static boolean isJavaTestFile(java.io.File file)
public static java.lang.String diagnosticToString(javax.tools.Diagnostic<? extends javax.tools.JavaFileObject> diagnostic, boolean usingAnomsgtxt)
public static java.util.Set<java.lang.String> diagnosticsToStrings(java.lang.Iterable<javax.tools.Diagnostic<? extends javax.tools.JavaFileObject>> actualDiagnostics, boolean usingAnomsgtxt)
public static java.lang.String summarizeSourceFiles(java.util.List<java.io.File> javaFiles)
public static java.io.File getTestFile(java.lang.String fileRelativeToTestsDir)
public static java.io.File findComparisonFile(java.io.File testFile)
public static java.util.List<java.lang.String> optionMapToList(java.util.Map<java.lang.String,java.lang.String> options)
public static void writeLines(java.io.File file, java.lang.Iterable<?> lines)
public static void writeDiagnostics(java.io.File file, java.io.File testFile, java.util.List<java.lang.String> expected, java.util.List<java.lang.String> actual, java.util.List<java.lang.String> unexpected, java.util.List<java.lang.String> missing, boolean usingNoMsgText, boolean testFailed)
public static void writeTestConfiguration(java.io.File file, TestConfiguration config)
public static void writeJavacArguments(java.io.File file, java.lang.Iterable<? extends javax.tools.JavaFileObject> files, java.lang.Iterable<java.lang.String> options, java.lang.Iterable<java.lang.String> processors)
public static void assertResultsAreValid(TypecheckResult testResult)
In a checker, we treat a more specific error message as subsumed by a general one. For example, "new.array.type.invalid" is subsumed by "type.invalid". This is not the case in the test framework; the exact error key is expected.
public static void ensureDirectoryExists(java.io.File path)
public static boolean testBooleanProperty(java.lang.String propName)
public static boolean testBooleanProperty(java.lang.String propName, boolean defaultValue)
public static boolean getShouldEmitDebugInfo()