use of org.junit.internal.runners.SuiteMethod 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();
}
}
Aggregations