use of org.apache.maven.surefire.util.DefaultScanResult in project tycho by eclipse.
the class TestMojo method scanForTests.
protected ScanResult scanForTests() {
List<String> defaultIncludes = Arrays.asList("**/Test*.class", "**/*Test.class", "**/*TestCase.class");
List<String> defaultExcludes = Arrays.asList("**/*$*");
List<String> includeList;
List<String> excludeList;
if (test != null) {
String test = this.test;
test = test.replace('.', '/');
test = test.endsWith(".class") ? test : test + ".class";
test = test.startsWith("**/") ? test : "**/" + test;
includeList = Collections.singletonList(test);
} else if (testClass != null) {
includeList = Collections.singletonList(testClass.replace('.', '/') + ".class");
} else if (includes != null) {
includeList = includes;
includeList.removeAll(Collections.singleton(null));
} else {
includeList = defaultIncludes;
}
if (excludes != null) {
excludeList = excludes;
excludeList.removeAll(Collections.singleton(null));
} else {
excludeList = defaultExcludes;
}
// TODO bug 495353 we should we rather let TestListResolver do the work here
// by passing in the unparsed String or Strings instead of already parsed include/exclude list
// (this would add support for running single test methods, negation etc.)
TestListResolver resolver = new TestListResolver(includeList, excludeList);
DirectoryScanner scanner = new DirectoryScanner(testClassesDirectory, resolver);
DefaultScanResult scanResult = scanner.scan();
return scanResult;
}
Aggregations