Package org.junit.platform.launcher.core
Class DefaultLauncher
- java.lang.Object
-
- org.junit.platform.launcher.core.DefaultLauncher
-
- All Implemented Interfaces:
Launcher
class DefaultLauncher extends java.lang.Object implements Launcher
Default implementation of theLauncher
API.External clients can obtain an instance by invoking
LauncherFactory.create()
.- Since:
- 1.0
- See Also:
Launcher
,LauncherFactory
-
-
Field Summary
Fields Modifier and Type Field Description private EngineDiscoveryResultValidator
discoveryResultValidator
private TestExecutionListenerRegistry
listenerRegistry
private static Logger
logger
private java.lang.Iterable<TestEngine>
testEngines
-
Constructor Summary
Constructors Constructor Description DefaultLauncher(java.lang.Iterable<TestEngine> testEngines)
Construct a newDefaultLauncher
with the supplied test engines.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private TestExecutionListenerRegistry
buildListenerRegistryForExecution(TestExecutionListener... listeners)
TestPlan
discover(LauncherDiscoveryRequest discoveryRequest)
Discover tests and build aTestPlan
according to the suppliedLauncherDiscoveryRequest
by querying all registered engines and collecting their results.private TestDescriptor
discoverEngineRoot(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest)
private Root
discoverRoot(LauncherDiscoveryRequest discoveryRequest, java.lang.String phase)
private void
execute(TestDescriptor engineDescriptor, EngineExecutionListener listener, ConfigurationParameters configurationParameters, TestEngine testEngine)
private void
execute(InternalTestPlan internalTestPlan, TestExecutionListener[] listeners)
void
execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners)
Execute aTestPlan
which is built according to the suppliedLauncherDiscoveryRequest
by querying all registered engines and collecting their results, and notify registered listeners about the progress and results of the execution.void
execute(TestPlan testPlan, TestExecutionListener... listeners)
Execute the suppliedTestPlan
and notify registered listeners about the progress and results of the execution.(package private) TestExecutionListenerRegistry
getTestExecutionListenerRegistry()
void
registerTestExecutionListeners(TestExecutionListener... listeners)
Register one or more listeners for test execution.private static java.lang.Iterable<TestEngine>
validateEngineIds(java.lang.Iterable<TestEngine> testEngines)
private static boolean
validateReservedIds(TestEngine testEngine)
private static void
validateWellKnownClassName(TestEngine testEngine, java.lang.String expectedClassName)
private void
withInterceptedStreams(ConfigurationParameters configurationParameters, TestExecutionListenerRegistry listenerRegistry, java.util.function.Consumer<TestExecutionListener> action)
-
-
-
Field Detail
-
logger
private static final Logger logger
-
listenerRegistry
private final TestExecutionListenerRegistry listenerRegistry
-
discoveryResultValidator
private final EngineDiscoveryResultValidator discoveryResultValidator
-
testEngines
private final java.lang.Iterable<TestEngine> testEngines
-
-
Constructor Detail
-
DefaultLauncher
DefaultLauncher(java.lang.Iterable<TestEngine> testEngines)
Construct a newDefaultLauncher
with the supplied test engines.- Parameters:
testEngines
- the test engines to delegate to; nevernull
or empty
-
-
Method Detail
-
validateEngineIds
private static java.lang.Iterable<TestEngine> validateEngineIds(java.lang.Iterable<TestEngine> testEngines)
-
validateReservedIds
private static boolean validateReservedIds(TestEngine testEngine)
-
validateWellKnownClassName
private static void validateWellKnownClassName(TestEngine testEngine, java.lang.String expectedClassName)
-
registerTestExecutionListeners
public void registerTestExecutionListeners(TestExecutionListener... listeners)
Description copied from interface:Launcher
Register one or more listeners for test execution.- Specified by:
registerTestExecutionListeners
in interfaceLauncher
- Parameters:
listeners
- the listeners to be notified of test execution events; nevernull
or empty
-
discover
public TestPlan discover(LauncherDiscoveryRequest discoveryRequest)
Description copied from interface:Launcher
Discover tests and build aTestPlan
according to the suppliedLauncherDiscoveryRequest
by querying all registered engines and collecting their results.- Specified by:
discover
in interfaceLauncher
- Parameters:
discoveryRequest
- the launcher discovery request; nevernull
- Returns:
- an unmodifiable
TestPlan
that contains all resolved identifiers from all registered engines
-
execute
public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners)
Description copied from interface:Launcher
Execute aTestPlan
which is built according to the suppliedLauncherDiscoveryRequest
by querying all registered engines and collecting their results, and notify registered listeners about the progress and results of the execution.Supplied test execution listeners are registered in addition to already registered listeners but only for the supplied launcher discovery request.
-
execute
public void execute(TestPlan testPlan, TestExecutionListener... listeners)
Description copied from interface:Launcher
Execute the suppliedTestPlan
and notify registered listeners about the progress and results of the execution.Supplied test execution listeners are registered in addition to already registered listeners but only for the execution of the supplied test plan.
-
getTestExecutionListenerRegistry
TestExecutionListenerRegistry getTestExecutionListenerRegistry()
-
discoverRoot
private Root discoverRoot(LauncherDiscoveryRequest discoveryRequest, java.lang.String phase)
-
discoverEngineRoot
private TestDescriptor discoverEngineRoot(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest)
-
execute
private void execute(InternalTestPlan internalTestPlan, TestExecutionListener[] listeners)
-
withInterceptedStreams
private void withInterceptedStreams(ConfigurationParameters configurationParameters, TestExecutionListenerRegistry listenerRegistry, java.util.function.Consumer<TestExecutionListener> action)
-
buildListenerRegistryForExecution
private TestExecutionListenerRegistry buildListenerRegistryForExecution(TestExecutionListener... listeners)
-
execute
private void execute(TestDescriptor engineDescriptor, EngineExecutionListener listener, ConfigurationParameters configurationParameters, TestEngine testEngine)
-
-