use of org.junit.internal.runners.ErrorReportingRunner in project intellij-community by JetBrains.
the class JUnit46ClassesRequestBuilder method collectWrappedRunners.
private static List collectWrappedRunners(Class[] classes) throws InitializationError {
final List runners = new ArrayList();
final List nonSuiteClasses = new ArrayList();
final SuiteMethodBuilder suiteMethodBuilder = new SuiteMethodBuilder();
for (int i = 0, length = classes.length; i < length; i++) {
Class aClass = classes[i];
if (suiteMethodBuilder.hasSuiteMethod(aClass)) {
try {
runners.add(new ClassAwareSuiteMethod(aClass));
} catch (Throwable throwable) {
runners.add(new ErrorReportingRunner(aClass, throwable));
}
} else {
nonSuiteClasses.add(aClass);
}
}
runners.addAll(new AllDefaultPossibilitiesBuilder(false).runners(null, (Class[]) nonSuiteClasses.toArray(new Class[nonSuiteClasses.size()])));
return runners;
}
use of org.junit.internal.runners.ErrorReportingRunner 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);
}
}
use of org.junit.internal.runners.ErrorReportingRunner in project junit4 by junit-team.
the class FilterRequest method getRunner.
@Override
public Runner getRunner() {
try {
Runner runner = request.getRunner();
fFilter.apply(runner);
return runner;
} catch (NoTestsRemainException e) {
return new ErrorReportingRunner(Filter.class, new Exception(String.format("No tests found matching %s from %s", fFilter.describe(), request.toString())));
}
}
use of org.junit.internal.runners.ErrorReportingRunner in project dspot by STAMP-project.
the class MethodFilterTest method testNoMatching.
@Test
public void testNoMatching() throws Exception {
// contains 0 testRunTestClass
Request request = Request.classes(MethodFilterTest.class);
request = request.filterWith(new MethodFilter(Collections.singletonList("testRunTestClass")));
assertTrue(request.getRunner() instanceof ErrorReportingRunner);
}
use of org.junit.internal.runners.ErrorReportingRunner in project junit4 by junit-team.
the class Request method classes.
/**
* Create a <code>Request</code> that, when processed, will run all the tests
* in a set of classes.
*
* @param computer Helps construct Runners from classes
* @param classes the classes containing the tests
* @return a <code>Request</code> that will cause all tests in the classes to be run
*/
public static Request classes(Computer computer, Class<?>... classes) {
try {
AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder();
Runner suite = computer.getSuite(builder, classes);
return runner(suite);
} catch (InitializationError e) {
return runner(new ErrorReportingRunner(e, classes));
}
}
Aggregations