use of com.carrotsearch.randomizedtesting.annotations.Listeners in project randomizedtesting by randomizedtesting.
the class RandomizedRunner method subscribeListeners.
/** Subscribe annotation listeners to the notifier. */
private void subscribeListeners(RunNotifier notifier) {
for (Listeners ann : getAnnotationsFromClassHierarchy(suiteClass, Listeners.class)) {
for (Class<? extends RunListener> clazz : ann.value()) {
try {
RunListener listener = clazz.newInstance();
autoListeners.add(listener);
notifier.addListener(listener);
} catch (Throwable t) {
throw new RuntimeException("Could not initialize suite class: " + suiteClass.getName() + " because its @Listener is not instantiable: " + clazz.getName(), t);
}
}
}
}
Aggregations