Methods Summary |
---|
public android.test.suitebuilder.TestGrouping | addPackagesRecursive(java.lang.String packageNames)Include all tests in the given packages and all their sub-packages, unless otherwise
specified. Each of the given packages must contain at least one test class, either directly
or in a sub-package.
for (String packageName : packageNames) {
List<Class<? extends TestCase>> addedClasses = testCaseClassesInPackage(packageName);
if (addedClasses.isEmpty()) {
Log.w("TestGrouping", "Invalid Package: '" + packageName
+ "' could not be found or has no tests");
}
testCaseClasses.addAll(addedClasses);
if (firstIncludedPackage == null) {
firstIncludedPackage = packageName;
}
}
return this;
|
public boolean | equals(java.lang.Object o)
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TestGrouping other = (TestGrouping) o;
if (!this.testCaseClasses.equals(other.testCaseClasses)) {
return false;
}
return this.testCaseClasses.comparator().equals(other.testCaseClasses.comparator());
|
public java.lang.String | getFirstIncludedPackage()
return firstIncludedPackage;
|
java.util.SortedSet | getTestCaseClasses()
return testCaseClasses;
|
protected java.util.List | getTestMethods(java.lang.Class testCaseClass)
List<Method> methods = Arrays.asList(testCaseClass.getMethods());
return select(methods, new TestMethodPredicate());
|
public java.util.List | getTests()
List<TestMethod> testMethods = new ArrayList<TestMethod>();
for (Class<? extends TestCase> testCase : testCaseClasses) {
for (Method testMethod : getTestMethods(testCase)) {
testMethods.add(new TestMethod(testMethod, testCase));
}
}
return testMethods;
|
public int | hashCode()
return testCaseClasses.hashCode();
|
public android.test.suitebuilder.TestGrouping | removePackagesRecursive(java.lang.String packageNames)Exclude all tests in the given packages and all their sub-packages, unless otherwise
specified.
for (String packageName : packageNames) {
testCaseClasses.removeAll(testCaseClassesInPackage(packageName));
}
return this;
|
private java.util.List | select(java.util.Collection items, com.android.internal.util.Predicate predicate)
ArrayList<T> selectedItems = new ArrayList<T>();
for (T item : items) {
if (predicate.apply(item)) {
selectedItems.add(item);
}
}
return selectedItems;
|
private java.util.List | selectTestClasses(java.util.Set allClasses)
List<Class<? extends TestCase>> testClasses = new ArrayList<Class<? extends TestCase>>();
for (Class<?> testClass : select(allClasses,
new TestCasePredicate())) {
testClasses.add((Class<? extends TestCase>) testClass);
}
return testClasses;
|
public void | setClassLoader(java.lang.ClassLoader classLoader)
this.classLoader = classLoader;
|
private java.util.List | testCaseClassesInPackage(java.lang.String packageName)
ClassPathPackageInfoSource source = PackageInfoSources.forClassPath(classLoader);
ClassPathPackageInfo packageInfo = source.getPackageInfo(packageName);
return selectTestClasses(packageInfo.getTopLevelClassesRecursive());
|