public class TestUtilities extends 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 List<File> |
deeplyEnclosedJavaTestFiles(File directory)
Returns all the java files that are descendants of the given directory
|
static Set<String> |
diagnosticsToStrings(Iterable<Diagnostic<? extends JavaFileObject>> actualDiagnostics,
boolean usingAnomsgtxt) |
static String |
diagnosticToString(Diagnostic<? extends JavaFileObject> diagnostic,
boolean usingAnomsgtxt) |
static void |
ensureDirectoryExists(File path) |
static File |
findComparisonFile(File testFile) |
static List<Object[]> |
findFilesInParent(File parent,
String... fileNames) |
static List<List<File>> |
findJavaFilesPerDirectory(File parent,
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 List<File> |
findNestedJavaTestFiles(String... dirNames) |
static List<File> |
findRelativeNestedJavaFiles(File parent,
String... dirNames) |
static List<File> |
findRelativeNestedJavaFiles(String parent,
String... dirNames) |
static List<File> |
getJavaFilesAsArgumentList(File... dirs)
Traverses the directories listed looking for java test files
|
static boolean |
getShouldEmitDebugInfo() |
static File |
getTestFile(String fileRelativeToTestsDir) |
static boolean |
isJavaFile(File file) |
static boolean |
isJavaTestFile(File file) |
static List<String> |
optionMapToList(Map<String,String> options) |
static String |
summarizeSourceFiles(List<File> javaFiles) |
static boolean |
testBooleanProperty(String propName) |
static boolean |
testBooleanProperty(String propName,
boolean defaultValue) |
static void |
writeDiagnostics(File file,
File testFile,
List<String> expected,
List<String> actual,
List<String> unexpected,
List<String> missing,
boolean usingNoMsgText,
boolean testFailed) |
static void |
writeJavacArguments(File file,
Iterable<? extends JavaFileObject> files,
Iterable<String> options,
Iterable<String> processors) |
static void |
writeLines(File file,
Iterable<?> lines) |
static void |
writeTestConfiguration(File file,
TestConfiguration config) |
public static final boolean isJSR308Compiler
public static final boolean isAtLeast8Jvm
public static List<File> findRelativeNestedJavaFiles(String parent, String... dirNames)
public static List<File> findRelativeNestedJavaFiles(File parent, String... dirNames)
public static List<List<File>> findJavaFilesPerDirectory(File parent, String... dirNames)
parent
- parent directory of the dirNames directoriesdirNames
- names of directories to searchpublic static List<File> getJavaFilesAsArgumentList(File... dirs)
public static List<File> deeplyEnclosedJavaTestFiles(File directory)
public static boolean isJavaFile(File file)
public static boolean isJavaTestFile(File file)
public static String diagnosticToString(Diagnostic<? extends JavaFileObject> diagnostic, boolean usingAnomsgtxt)
public static Set<String> diagnosticsToStrings(Iterable<Diagnostic<? extends JavaFileObject>> actualDiagnostics, boolean usingAnomsgtxt)
public static void writeDiagnostics(File file, File testFile, List<String> expected, List<String> actual, List<String> unexpected, List<String> missing, boolean usingNoMsgText, boolean testFailed)
public static void writeTestConfiguration(File file, TestConfiguration config)
public static void writeJavacArguments(File file, Iterable<? extends JavaFileObject> files, Iterable<String> options, Iterable<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(File path)
public static boolean testBooleanProperty(String propName)
public static boolean testBooleanProperty(String propName, boolean defaultValue)
public static boolean getShouldEmitDebugInfo()