Launcher in the
context of a LauncherSession.
Interceptors are instantiated once per LauncherSession and closed
after the session is closed. They can
intercept the following invocations:
LauncherSessionListener instances registered via the
ServiceLoader mechanism
Launcher instances
Launcher#discover(LauncherDiscoveryRequest),
Launcher#execute(TestPlan, TestExecutionListener...) ,
Launcher#execute(LauncherDiscoveryRequest, TestExecutionListener...) ,
and Launcher#execute(LauncherExecutionRequest),
Implementations of this interface can be registered via the
ServiceLoader mechanism by additionally
setting the junit.platform.launcher.interceptors.enabled
configuration parameter to true.
A typical use case is to create a custom ClassLoader in the
constructor of the implementing class, replace the
contextClassLoader of the
current thread while intercepting invocations,
and close the custom ClassLoader in close()
Launcher, LauncherSession, LauncherConstants#ENABLE_LAUNCHER_INTERCEPTORS
| Modifier and Type | Class and Description |
|---|---|
| public static interface |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public <T extends @Nullable Object> T | Returns: the result of the invocationthe intercepted invocation; never invocationnullIntercept the supplied invocation. |
| close | back to summary |
|---|---|
| public void close() Closes this interceptor. Any resources held by this interceptor should be released by this method. | |
| intercept | back to summary |
|---|---|
| public <T extends @Nullable Object> T intercept(LauncherInterceptor. Intercept the supplied invocation. Implementations must call
| |
This interface is not intended to be implemented by clients.
| Modifier and Type | Method and Description |
|---|---|
| public T |
| proceed | back to summary |
|---|---|
| public T proceed() | |