- java.lang.Object
-
- org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine<JupiterEngineExecutionContext>
-
- org.junit.jupiter.engine.JupiterTestEngine
-
- All Implemented Interfaces:
TestEngine
@API(status=INTERNAL, since="5.0") public final class JupiterTestEngine extends HierarchicalTestEngine<JupiterEngineExecutionContext>
The JUnit JupiterTestEngine
.- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description JupiterTestEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JupiterEngineExecutionContext
createExecutionContext(ExecutionRequest request)
Create the initial execution context for executing the supplied request.protected HierarchicalTestExecutorService
createExecutorService(ExecutionRequest request)
Create the executor service to use for executing the supplied request.protected ThrowableCollector.Factory
createThrowableCollectorFactory(ExecutionRequest request)
Create the factory for creatingThrowableCollector
instances used to handle exceptions that occur during execution of this engine's tests.TestDescriptor
discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId)
Discover tests according to the suppliedEngineDiscoveryRequest
.Optional<String>
getArtifactId()
Returnsjunit-jupiter-engine
as the artifact ID.Optional<String>
getGroupId()
Returnsorg.junit.jupiter
as the group ID.String
getId()
Get the ID that uniquely identifies this test engine.-
Methods inherited from class org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine
execute
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.junit.platform.engine.TestEngine
getVersion
-
-
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:TestEngine
Get the ID that uniquely identifies this test engine.Each test engine must provide a unique ID. For example, JUnit Vintage and JUnit Jupiter use
"junit-vintage"
and"junit-jupiter"
, respectively. When in doubt, you may use the fully qualified name of your customTestEngine
implementation class.
-
getGroupId
public Optional<String> getGroupId()
Returnsorg.junit.jupiter
as the group ID.- Returns:
- an
Optional
containing the group ID; nevernull
but potentially empty if the group ID is unknown - See Also:
TestEngine.getArtifactId()
,TestEngine.getVersion()
-
getArtifactId
public Optional<String> getArtifactId()
Returnsjunit-jupiter-engine
as the artifact ID.- Returns:
- an
Optional
containing the artifact ID; nevernull
but potentially empty if the artifact ID is unknown - See Also:
Class.getPackage()
,Package.getImplementationTitle()
,TestEngine.getGroupId()
,TestEngine.getVersion()
-
discover
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId)
Description copied from interface:TestEngine
Discover tests according to the suppliedEngineDiscoveryRequest
.The supplied
UniqueId
must be used as the unique ID of the returned rootTestDescriptor
. In addition, theUniqueId
must be used to create unique IDs for children of the root's descriptor by callingUniqueId.append(java.lang.String, java.lang.String)
.- Parameters:
discoveryRequest
- the discovery request; nevernull
uniqueId
- the unique ID to be used for this test engine'sTestDescriptor
; nevernull
- Returns:
- the root
TestDescriptor
of this engine, typically an instance ofEngineDescriptor
- See Also:
EngineDescriptor
-
createExecutorService
protected HierarchicalTestExecutorService createExecutorService(ExecutionRequest request)
Description copied from class:HierarchicalTestEngine
Create the executor service to use for executing the supplied request.An engine may use the information in the supplied request such as the contained configuration parameters to decide what kind of service to return or how to configure it.
By default, this method returns an instance of
SameThreadHierarchicalTestExecutorService
.- Overrides:
createExecutorService
in classHierarchicalTestEngine<JupiterEngineExecutionContext>
- Parameters:
request
- the request about to be executed- See Also:
ForkJoinPoolHierarchicalTestExecutorService
,SameThreadHierarchicalTestExecutorService
-
createExecutionContext
protected JupiterEngineExecutionContext createExecutionContext(ExecutionRequest request)
Description copied from class:HierarchicalTestEngine
Create the initial execution context for executing the supplied request.- Specified by:
createExecutionContext
in classHierarchicalTestEngine<JupiterEngineExecutionContext>
- Parameters:
request
- the request about to be executed- Returns:
- the initial context that will be passed to nodes in the hierarchy
-
createThrowableCollectorFactory
protected ThrowableCollector.Factory createThrowableCollectorFactory(ExecutionRequest request)
Description copied from class:HierarchicalTestEngine
Create the factory for creatingThrowableCollector
instances used to handle exceptions that occur during execution of this engine's tests.An engine may use the information in the supplied request such as the contained configuration parameters to decide what kind of factory to return or how to configure it.
By default, this method returns a factory that always creates instances of
OpenTest4JAwareThrowableCollector
.- Overrides:
createThrowableCollectorFactory
in classHierarchicalTestEngine<JupiterEngineExecutionContext>
- Parameters:
request
- the request about to be executed- Since:
- 5.4
- See Also:
OpenTest4JAwareThrowableCollector
,ThrowableCollector
-
-