use of com.intellij.TestCaseLoader in project intellij-community by JetBrains.
the class AllTestsSuite method getSuiteClasses.
private static Class<?>[] getSuiteClasses(Class<?> klass) throws InitializationError {
TestPackage annotation = klass.getAnnotation(TestPackage.class);
if (annotation == null)
throw new InitializationError("No test package specified");
String testPackage = annotation.value();
SlowPolicy policy = annotation.policy();
TestCaseLoader loader = new TestCaseLoader("", true);
try {
TestAll.fillTestCases(loader, testPackage, TestAll.getClassRoots());
} catch (IOException e) {
throw new InitializationError(e);
}
List<Class<?>> result = ContainerUtil.newArrayList();
for (Class aClass : loader.getClasses()) {
if (policy == SlowPolicy.ALL) {
result.add(aClass);
} else {
boolean slow = isSlow(aClass);
if (slow && policy == SlowPolicy.SLOW_ONLY || !slow && policy == SlowPolicy.FAST_ONLY) {
result.add(aClass);
}
}
}
return result.toArray(ArrayUtil.EMPTY_CLASS_ARRAY);
}
Aggregations