Search in sources :

Example 1 with Listeners

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);
            }
        }
    }
}
Also used : Listeners(com.carrotsearch.randomizedtesting.annotations.Listeners) RunListener(org.junit.runner.notification.RunListener)

Aggregations

Listeners (com.carrotsearch.randomizedtesting.annotations.Listeners)1 RunListener (org.junit.runner.notification.RunListener)1