Top Description Constructors Methods
org.junit.platform.launcher.core

public Class LauncherFactory

extends Object
Class Inheritance
Annotations
@API
status:STABLE
since:1.0
Static Imports
org.apiguardian.api.API.Status.STABLE, org.junit.platform.launcher.LauncherConstants.DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME, .LauncherConstants.ENABLE_LAUNCHER_INTERCEPTORS

Factory for creating Launcher instances by invoking create() or create(LauncherConfig).

By default, test engines are discovered at runtime using the ServiceLoader mechanism. For that purpose, a text file named META-INF/services/org.junit.platform.engine.TestEngine has to be added to the engine's JAR file in which the fully qualified name of the implementation class of the org.junit.platform.engine.TestEngine interface is declared.

By default, test execution listeners are discovered at runtime via the ServiceLoader mechanism and are automatically registered with the Launcher created by this factory. Users may register additional listeners using the Launcher#registerTestExecutionListeners(TestExecutionListener...) method on the created launcher instance.

For full control over automatic registration and programmatic registration of test engines and listeners, supply an instance of LauncherConfig to create(LauncherConfig).

Since
1.0
See Also
Launcher, LauncherConfig

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static List<LauncherInterceptor>
private static List<PostDiscoveryFilter>
private static Set<TestEngine>
public static Launcher
create()

Factory method for creating a new Launcher using the default LauncherConfig.

public static Launcher
create(LauncherConfig
the configuration for the launcher; never null
config
)

Factory method for creating a new Launcher using the supplied LauncherConfig.

private static DefaultLauncher
private static LauncherSessionListener
private static Iterable<TestExecutionListener>
public static LauncherSession
openSession()

Factory method for opening a new LauncherSession using the default LauncherConfig.

public static LauncherSession
openSession(LauncherConfig
the configuration for the session and the launcher; never null
config
)

Factory method for opening a new LauncherSession using the supplied LauncherConfig.

private static void
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LauncherFactoryback to summary
private LauncherFactory()

Method Detail

collectLauncherInterceptorsback to summary
private static List<LauncherInterceptor> collectLauncherInterceptors(LauncherConfigurationParameters configurationParameters)
collectPostDiscoveryFiltersback to summary
private static List<PostDiscoveryFilter> collectPostDiscoveryFilters(LauncherConfig config)
collectTestEnginesback to summary
private static Set<TestEngine> collectTestEngines(LauncherConfig config)
createback to summary
public static Launcher create() throws PreconditionViolationException

Factory method for creating a new Launcher using the default LauncherConfig.

Exceptions
PreconditionViolationException:
if no test engines are detected
See Also
create(LauncherConfig)
createback to summary
public static Launcher create(LauncherConfig config) throws PreconditionViolationException

Factory method for creating a new Launcher using the supplied LauncherConfig.

Parameters
config:LauncherConfig

the configuration for the launcher; never null

Annotations
@API
status:STABLE
since:1.10
Exceptions
PreconditionViolationException:
if the supplied configuration is null, or if no test engines are detected registered
Since
1.3
See Also
create()
createDefaultLauncherback to summary
private static DefaultLauncher createDefaultLauncher(LauncherConfig config, LauncherConfigurationParameters configurationParameters, NamespacedHierarchicalStore<Namespace> sessionLevelStore)
createLauncherSessionListenerback to summary
private static LauncherSessionListener createLauncherSessionListener(LauncherConfig config)
loadAndFilterTestExecutionListenersback to summary
private static Iterable<TestExecutionListener> loadAndFilterTestExecutionListeners(ConfigurationParameters configurationParameters)
openSessionback to summary
public static LauncherSession openSession() throws PreconditionViolationException

Factory method for opening a new LauncherSession using the default LauncherConfig.

Annotations
@API
status:STABLE
since:1.10
Exceptions
PreconditionViolationException:
if no test engines are detected
Since
1.8
See Also
openSession(LauncherConfig)
openSessionback to summary
public static LauncherSession openSession(LauncherConfig config) throws PreconditionViolationException

Factory method for opening a new LauncherSession using the supplied LauncherConfig.

Parameters
config:LauncherConfig

the configuration for the session and the launcher; never null

Annotations
@API
status:STABLE
since:1.10
Exceptions
PreconditionViolationException:
if the supplied configuration is null, or if no test engines are detected
Since
1.8
See Also
openSession()
registerLauncherDiscoveryListenersback to summary
private static void registerLauncherDiscoveryListeners(LauncherConfig config, Launcher launcher)
registerTestExecutionListenersback to summary
private static void registerTestExecutionListeners(LauncherConfig config, Launcher launcher, LauncherConfigurationParameters configurationParameters)