use of org.junit.runners.Suite in project intellij-community by JetBrains.
the class IdeaSuite method skipSuiteComponents.
private void skipSuiteComponents(Set allNames, Object child) {
try {
if (child instanceof Suite) {
final Method getChildrenMethod = Suite.class.getDeclaredMethod("getChildren", new Class[0]);
getChildrenMethod.setAccessible(true);
final List tests = (List) getChildrenMethod.invoke(child, new Object[0]);
for (Iterator suiteIterator = tests.iterator(); suiteIterator.hasNext(); ) {
final String displayName = describeChild((Runner) suiteIterator.next()).getDisplayName();
if (allNames.contains(displayName)) {
allNames.remove(displayName);
}
}
} else if (child instanceof SuiteMethod) {
final Method getChildrenMethod = JUnit38ClassRunner.class.getDeclaredMethod("getTest", new Class[0]);
getChildrenMethod.setAccessible(true);
final Test test = (Test) getChildrenMethod.invoke(child, new Object[0]);
if (test instanceof TestSuite) {
final Enumeration tests = ((TestSuite) test).tests();
while (tests.hasMoreElements()) {
final Test t = (Test) tests.nextElement();
if (t instanceof TestSuite) {
final String testDescription = ((TestSuite) t).getName();
if (allNames.contains(testDescription)) {
allNames.remove(testDescription);
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.junit.runners.Suite in project jena by apache.
the class ManifestSuite method oneManifest.
private Runner oneManifest(final Manifest manifest, List<Runner> r) {
// Recurse
for (Iterator<String> iter = manifest.includedManifests(); iter.hasNext(); ) {
try {
r.add(oneManifest(new Manifest(iter.next()), new ArrayList<Runner>()));
} catch (JenaException ex) {
r.add(new ErrorReportingRunner(null, ex));
}
}
itemHandler.setTestRunnerList(r);
manifest.apply(itemHandler);
try {
return new Suite((Class<?>) null, r) {
@Override
protected String getName() {
return manifest.getName();
}
};
} catch (InitializationError e) {
return new ErrorReportingRunner(null, e);
}
}
Aggregations