private static Runner createRunnerFor(List<? extends Class<?>> targetClasses, final List<Filter> filters) throws InitializationError {
RunnerBuilder runnerBuilder = new RunnerBuilder() {
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
for (Class<?> candidate = testClass; candidate != null; candidate = candidate.getSuperclass()) {
RunWith runWith = candidate.getAnnotation(RunWith.class);
if (runWith != null && !AbstractMultiTestRunner.class.isAssignableFrom(runWith.value())) {
try {
Runner r = (Runner) runWith.value().getConstructors()[0].newInstance(testClass);
return filter(r);
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
}