Search in sources :

Example 1 with BeforeAllCallback

use of org.junit.jupiter.api.extension.BeforeAllCallback in project junit5 by junit-team.

the class ClassTestDescriptor method invokeBeforeAllCallbacks.

private void invokeBeforeAllCallbacks(JupiterEngineExecutionContext context) {
    ExtensionRegistry registry = context.getExtensionRegistry();
    ExtensionContext extensionContext = context.getExtensionContext();
    ThrowableCollector throwableCollector = context.getThrowableCollector();
    for (BeforeAllCallback callback : registry.getExtensions(BeforeAllCallback.class)) {
        throwableCollector.execute(() -> callback.beforeAll(extensionContext));
        if (throwableCollector.isNotEmpty()) {
            break;
        }
    }
}
Also used : BeforeAllCallback(org.junit.jupiter.api.extension.BeforeAllCallback) ExtensionContext(org.junit.jupiter.api.extension.ExtensionContext) ExtensionRegistry(org.junit.jupiter.engine.extension.ExtensionRegistry) ThrowableCollector(org.junit.jupiter.engine.execution.ThrowableCollector)

Aggregations

BeforeAllCallback (org.junit.jupiter.api.extension.BeforeAllCallback)1 ExtensionContext (org.junit.jupiter.api.extension.ExtensionContext)1 ThrowableCollector (org.junit.jupiter.engine.execution.ThrowableCollector)1 ExtensionRegistry (org.junit.jupiter.engine.extension.ExtensionRegistry)1