executionListener.testClassFinished(failure);
}
private void runTestClass(String testClassName) throws ClassNotFoundException {
final Class<?> testClass = Class.forName(testClassName, false, applicationClassLoader);
Request request = Request.aClass(testClass);
if (options.hasCategoryConfiguration()) {
Transformer<Class<?>, String> transformer = new Transformer<Class<?>, String>() {
public Class<?> transform(final String original) {
try {
return applicationClassLoader.loadClass(original);
} catch (ClassNotFoundException e) {
throw new InvalidUserDataException(String.format("Can't load category class [%s].", original), e);
}
}
};
request = request.filterWith(new CategoryFilter(
CollectionUtils.collect(options.getIncludeCategories(), transformer),
CollectionUtils.collect(options.getExcludeCategories(), transformer)
));
}
if (!options.getIncludedTests().isEmpty()) {
request = request.filterWith(new MethodNameFilter(options.getIncludedTests()));
}
Runner runner = request.getRunner();
//In case of no matching methods junit will return a ErrorReportingRunner for org.junit.runner.manipulation.Filter.class.
//Will be fixed with adding class filters
if (!org.junit.runner.manipulation.Filter.class.getName().equals(runner.getDescription().getDisplayName())) {
RunNotifier notifier = new RunNotifier();
notifier.addListener(listener);