Top Description Inners Fields Methods
org.junit.platform.launcher.core

public Interface LauncherConfig

Known Direct Implementers
org.junit.platform.launcher.core.DefaultLauncherConfig
Annotations
@API
status:STABLE
since:1.7
Static Imports
org.apiguardian.api.API.Status.STABLE

LauncherConfig defines the configuration API for creating Launcher instances via the LauncherFactory.

Example

LauncherConfig launcherConfig = LauncherConfig.builder()
  .enableTestEngineAutoRegistration(false)
  .enableTestExecutionListenerAutoRegistration(false)
  .addTestEngines(new CustomTestEngine())
  .addTestExecutionListeners(new CustomTestExecutionListener())
  .build();

Launcher launcher = LauncherFactory.create(launcherConfig);
LauncherDiscoveryRequest discoveryRequest = ...
launcher.execute(discoveryRequest);
Since
1.3
See Also
builder(), Launcher, LauncherFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final LauncherConfig
DEFAULT

The default LauncherConfig which uses automatic registration for test engines, supported listeners, and post-discovery filters.

Method Summary

Modifier and TypeMethod and Description
public static LauncherConfig.Builder

Returns:

a new builder; never null
builder
()

Create a new LauncherConfig.Builder.

public Collection<LauncherDiscoveryListener>

Returns:

the collection of additional launcher discovery listeners; never null but potentially empty
getAdditionalLauncherDiscoveryListeners
()

Get the collection of additional launcher discovery listeners that should be added to the Launcher.

public Collection<LauncherSessionListener>

Returns:

the collection of additional launcher session listeners; never null but potentially empty
getAdditionalLauncherSessionListeners
()

Get the collection of additional launcher session listeners that should be added to the Launcher.

public Collection<PostDiscoveryFilter>

Returns:

the collection of additional post discovery filters; never null but potentially empty
getAdditionalPostDiscoveryFilters
()

Get the collection of additional post discovery filters that should be added to the Launcher.

public Collection<TestEngine>

Returns:

the collection of additional test engines; never null but potentially empty
getAdditionalTestEngines
()

Get the collection of additional test engines that should be added to the Launcher.

public Collection<TestExecutionListener>

Returns:

the collection of additional test execution listeners; never null but potentially empty
getAdditionalTestExecutionListeners
()

Get the collection of additional test execution listeners that should be added to the Launcher.

public boolean

Returns:

true if launcher discovery listeners should be automatically registered
isLauncherDiscoveryListenerAutoRegistrationEnabled
()

Determine if launcher discovery listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

public boolean

Returns:

true if launcher session listeners should be automatically registered
isLauncherSessionListenerAutoRegistrationEnabled
()

Determine if launcher session listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

public boolean

Returns:

true if post discovery filters should be automatically registered
isPostDiscoveryFilterAutoRegistrationEnabled
()

Determine if post discovery filters should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

public boolean

Returns:

true if test engines should be automatically registered
isTestEngineAutoRegistrationEnabled
()

Determine if test engines should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

public boolean

Returns:

true if test execution listeners should be automatically registered
isTestExecutionListenerAutoRegistrationEnabled
()

Determine if test execution listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Field Detail

DEFAULTback to summary
public static final LauncherConfig DEFAULT

The default LauncherConfig which uses automatic registration for test engines, supported listeners, and post-discovery filters.

Method Detail

builderback to summary
public static LauncherConfig.Builder builder()

Create a new LauncherConfig.Builder.

Returns:LauncherConfig.Builder

a new builder; never null

getAdditionalLauncherDiscoveryListenersback to summary
public Collection<LauncherDiscoveryListener> getAdditionalLauncherDiscoveryListeners()

Get the collection of additional launcher discovery listeners that should be added to the Launcher.

Returns:Collection<LauncherDiscoveryListener>

the collection of additional launcher discovery listeners; never null but potentially empty

Annotations
@API
status:STABLE
since:1.10
Since
1.8
getAdditionalLauncherSessionListenersback to summary
public Collection<LauncherSessionListener> getAdditionalLauncherSessionListeners()

Get the collection of additional launcher session listeners that should be added to the Launcher.

Returns:Collection<LauncherSessionListener>

the collection of additional launcher session listeners; never null but potentially empty

Annotations
@API
status:STABLE
since:1.10
Since
1.8
getAdditionalPostDiscoveryFiltersback to summary
public Collection<PostDiscoveryFilter> getAdditionalPostDiscoveryFilters()

Get the collection of additional post discovery filters that should be added to the Launcher.

Returns:Collection<PostDiscoveryFilter>

the collection of additional post discovery filters; never null but potentially empty

Annotations
@API
status:STABLE
since:1.10
Since
1.7
getAdditionalTestEnginesback to summary
public Collection<TestEngine> getAdditionalTestEngines()

Get the collection of additional test engines that should be added to the Launcher.

Returns:Collection<TestEngine>

the collection of additional test engines; never null but potentially empty

getAdditionalTestExecutionListenersback to summary
public Collection<TestExecutionListener> getAdditionalTestExecutionListeners()

Get the collection of additional test execution listeners that should be added to the Launcher.

Returns:Collection<TestExecutionListener>

the collection of additional test execution listeners; never null but potentially empty

isLauncherDiscoveryListenerAutoRegistrationEnabledback to summary
public boolean isLauncherDiscoveryListenerAutoRegistrationEnabled()

Determine if launcher discovery listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Returns:boolean

true if launcher discovery listeners should be automatically registered

Annotations
@API
status:STABLE
since:1.10
Since
1.8
isLauncherSessionListenerAutoRegistrationEnabledback to summary
public boolean isLauncherSessionListenerAutoRegistrationEnabled()

Determine if launcher session listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Returns:boolean

true if launcher session listeners should be automatically registered

Annotations
@API
status:STABLE
since:1.10
Since
1.8
isPostDiscoveryFilterAutoRegistrationEnabledback to summary
public boolean isPostDiscoveryFilterAutoRegistrationEnabled()

Determine if post discovery filters should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Returns:boolean

true if post discovery filters should be automatically registered

Annotations
@API
status:STABLE
since:1.10
Since
1.7
isTestEngineAutoRegistrationEnabledback to summary
public boolean isTestEngineAutoRegistrationEnabled()

Determine if test engines should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Returns:boolean

true if test engines should be automatically registered

isTestExecutionListenerAutoRegistrationEnabledback to summary
public boolean isTestExecutionListenerAutoRegistrationEnabled()

Determine if test execution listeners should be discovered at runtime using the ServiceLoader mechanism and automatically registered.

Returns:boolean

true if test execution listeners should be automatically registered

org.junit.platform.launcher.core back to summary

public Class LauncherConfig.Builder

extends Object
Class Inheritance

Builder API for LauncherConfig.

Field Summary

Modifier and TypeField and Description
private final Collection<LauncherDiscoveryListener>
private boolean
private final Collection<TestEngine>
private final Collection<TestExecutionListener>
private boolean
private boolean
private boolean
private final Collection<PostDiscoveryFilter>
private final Collection<LauncherSessionListener>
private boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public LauncherConfig.Builder

Returns:

this builder for method chaining
addLauncherDiscoveryListeners
(LauncherDiscoveryListener...
additional launcher discovery listeners to register; never null or containing null
listeners
)

Add all of the supplied launcher discovery listeners to the configuration.

public LauncherConfig.Builder

Returns:

this builder for method chaining
addLauncherSessionListeners
(LauncherSessionListener...
additional launcher session listeners to register; never null or containing null
listeners
)

Add all of the supplied launcher session listeners to the configuration.

public LauncherConfig.Builder

Returns:

this builder for method chaining
addPostDiscoveryFilters
(PostDiscoveryFilter...
additional post discovery filters to register; never null or containing null
filters
)

Add all of the supplied filters to the configuration.

public LauncherConfig.Builder

Returns:

this builder for method chaining
addTestEngines
(TestEngine...
additional test engines to register; never null or containing null
engines
)

Add all of the supplied test engines to the configuration.

public LauncherConfig.Builder

Returns:

this builder for method chaining
addTestExecutionListeners
(TestExecutionListener...
additional test execution listeners to register; never null or containing null
listeners
)

Add all of the supplied test execution listeners to the configuration.

public LauncherConfig
build()

Build the LauncherConfig that has been configured via this builder.

public LauncherConfig.Builder

Returns:

this builder for method chaining
enableLauncherDiscoveryListenerAutoRegistration
(boolean
true if launcher discovery listeners should be automatically registered
enabled
)

Configure the auto-registration flag for launcher discovery listeners.

public LauncherConfig.Builder

Returns:

this builder for method chaining
enableLauncherSessionListenerAutoRegistration
(boolean
true if launcher session listeners should be automatically registered
enabled
)

Configure the auto-registration flag for launcher session listeners.

public LauncherConfig.Builder

Returns:

this builder for method chaining
enablePostDiscoveryFilterAutoRegistration
(boolean
true if post discovery filters should be automatically registered
enabled
)

Configure the auto-registration flag for post discovery filters.

public LauncherConfig.Builder

Returns:

this builder for method chaining
enableTestEngineAutoRegistration
(boolean
true if test engines should be automatically registered
enabled
)

Configure the auto-registration flag for test engines.

public LauncherConfig.Builder

Returns:

this builder for method chaining
enableTestExecutionListenerAutoRegistration
(boolean
true if test execution listeners should be automatically registered
enabled
)

Configure the auto-registration flag for test execution listeners.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

discoveryListenersback to summary
private final Collection<LauncherDiscoveryListener> discoveryListeners
engineAutoRegistrationEnabledback to summary
private boolean engineAutoRegistrationEnabled
enginesback to summary
private final Collection<TestEngine> engines
executionListenersback to summary
private final Collection<TestExecutionListener> executionListeners
launcherDiscoveryListenerAutoRegistrationEnabledback to summary
private boolean launcherDiscoveryListenerAutoRegistrationEnabled
launcherSessionListenerAutoRegistrationEnabledback to summary
private boolean launcherSessionListenerAutoRegistrationEnabled
postDiscoveryFilterAutoRegistrationEnabledback to summary
private boolean postDiscoveryFilterAutoRegistrationEnabled
postDiscoveryFiltersback to summary
private final Collection<PostDiscoveryFilter> postDiscoveryFilters
sessionListenersback to summary
private final Collection<LauncherSessionListener> sessionListeners
testExecutionListenerAutoRegistrationEnabledback to summary
private boolean testExecutionListenerAutoRegistrationEnabled

Constructor Detail

Builderback to summary
private Builder()

Method Detail

addLauncherDiscoveryListenersback to summary
public LauncherConfig.Builder addLauncherDiscoveryListeners(LauncherDiscoveryListener... listeners)

Add all of the supplied launcher discovery listeners to the configuration.

Parameters
listeners:LauncherDiscoveryListener[]

additional launcher discovery listeners to register; never null or containing null

Returns:LauncherConfig.Builder

this builder for method chaining

addLauncherSessionListenersback to summary
public LauncherConfig.Builder addLauncherSessionListeners(LauncherSessionListener... listeners)

Add all of the supplied launcher session listeners to the configuration.

Parameters
listeners:LauncherSessionListener[]

additional launcher session listeners to register; never null or containing null

Returns:LauncherConfig.Builder

this builder for method chaining

addPostDiscoveryFiltersback to summary
public LauncherConfig.Builder addPostDiscoveryFilters(PostDiscoveryFilter... filters)

Add all of the supplied filters to the configuration.

Parameters
filters:PostDiscoveryFilter[]

additional post discovery filters to register; never null or containing null

Returns:LauncherConfig.Builder

this builder for method chaining

Annotations
@API
status:STABLE
since:1.10
Since
1.7
addTestEnginesback to summary
public LauncherConfig.Builder addTestEngines(TestEngine... engines)

Add all of the supplied test engines to the configuration.

Parameters
engines:TestEngine[]

additional test engines to register; never null or containing null

Returns:LauncherConfig.Builder

this builder for method chaining

addTestExecutionListenersback to summary
public LauncherConfig.Builder addTestExecutionListeners(TestExecutionListener... listeners)

Add all of the supplied test execution listeners to the configuration.

Parameters
listeners:TestExecutionListener[]

additional test execution listeners to register; never null or containing null

Returns:LauncherConfig.Builder

this builder for method chaining

buildback to summary
public LauncherConfig build()

Build the LauncherConfig that has been configured via this builder.

enableLauncherDiscoveryListenerAutoRegistrationback to summary
public LauncherConfig.Builder enableLauncherDiscoveryListenerAutoRegistration(boolean enabled)

Configure the auto-registration flag for launcher discovery listeners.

Defaults to true.

Parameters
enabled:boolean

true if launcher discovery listeners should be automatically registered

Returns:LauncherConfig.Builder

this builder for method chaining

Annotations
@API
status:STABLE
since:1.10
Since
1.8
enableLauncherSessionListenerAutoRegistrationback to summary
public LauncherConfig.Builder enableLauncherSessionListenerAutoRegistration(boolean enabled)

Configure the auto-registration flag for launcher session listeners.

Defaults to true.

Parameters
enabled:boolean

true if launcher session listeners should be automatically registered

Returns:LauncherConfig.Builder

this builder for method chaining

Annotations
@API
status:STABLE
since:1.10
Since
1.8
enablePostDiscoveryFilterAutoRegistrationback to summary
public LauncherConfig.Builder enablePostDiscoveryFilterAutoRegistration(boolean enabled)

Configure the auto-registration flag for post discovery filters.

Defaults to true.

Parameters
enabled:boolean

true if post discovery filters should be automatically registered

Returns:LauncherConfig.Builder

this builder for method chaining

Annotations
@API
status:STABLE
since:1.10
Since
1.7
enableTestEngineAutoRegistrationback to summary
public LauncherConfig.Builder enableTestEngineAutoRegistration(boolean enabled)

Configure the auto-registration flag for test engines.

Defaults to true.

Parameters
enabled:boolean

true if test engines should be automatically registered

Returns:LauncherConfig.Builder

this builder for method chaining

enableTestExecutionListenerAutoRegistrationback to summary
public LauncherConfig.Builder enableTestExecutionListenerAutoRegistration(boolean enabled)

Configure the auto-registration flag for test execution listeners.

Defaults to true.

Parameters
enabled:boolean

true if test execution listeners should be automatically registered

Returns:LauncherConfig.Builder

this builder for method chaining