Class ExecutionListenerAdapter
- java.lang.Object
-
- org.junit.platform.launcher.core.ExecutionListenerAdapter
-
- All Implemented Interfaces:
EngineExecutionListener
class ExecutionListenerAdapter extends java.lang.Object implements EngineExecutionListener
AnExecutionListenerAdapter
adapts aTestPlan
and a correspondingTestExecutionListener
to theEngineExecutionListener
API.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private TestExecutionListener
testExecutionListener
private TestPlan
testPlan
-
Fields inherited from interface org.junit.platform.engine.EngineExecutionListener
NOOP
-
-
Constructor Summary
Constructors Constructor Description ExecutionListenerAdapter(TestPlan testPlan, TestExecutionListener testExecutionListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dynamicTestRegistered(TestDescriptor testDescriptor)
Must be called when a new, dynamicTestDescriptor
has been registered.void
executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult)
Must be called when the execution of a leaf or subtree of the test tree has finished, regardless of the outcome.void
executionSkipped(TestDescriptor testDescriptor, java.lang.String reason)
Must be called when the execution of a leaf or subtree of the test tree has been skipped.void
executionStarted(TestDescriptor testDescriptor)
Must be called when the execution of a leaf or subtree of the test tree is about to be started.private TestIdentifier
getTestIdentifier(TestDescriptor testDescriptor)
void
reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry)
Can be called for anyTestDescriptor
in order to publish additional information to the reporting infrastructure — for example: Output that would otherwise go toSystem.out
Information about test context or test data
-
-
-
Field Detail
-
testPlan
private final TestPlan testPlan
-
testExecutionListener
private final TestExecutionListener testExecutionListener
-
-
Constructor Detail
-
ExecutionListenerAdapter
ExecutionListenerAdapter(TestPlan testPlan, TestExecutionListener testExecutionListener)
-
-
Method Detail
-
dynamicTestRegistered
public void dynamicTestRegistered(TestDescriptor testDescriptor)
Description copied from interface:EngineExecutionListener
Must be called when a new, dynamicTestDescriptor
has been registered.A dynamic test is a test that is not known a-priori and therefore was not present in the test tree when discovering tests.
- Specified by:
dynamicTestRegistered
in interfaceEngineExecutionListener
- Parameters:
testDescriptor
- the descriptor of the newly registered test or container
-
executionStarted
public void executionStarted(TestDescriptor testDescriptor)
Description copied from interface:EngineExecutionListener
Must be called when the execution of a leaf or subtree of the test tree is about to be started.The
TestDescriptor
may represent a test or a container. In the case of a container, engines have to fire additional events for its children.This method may only be called if the test or container has not been skipped.
This method must be called for a container
TestDescriptor
before starting or skipping any of its children.- Specified by:
executionStarted
in interfaceEngineExecutionListener
- Parameters:
testDescriptor
- the descriptor of the started test or container
-
executionSkipped
public void executionSkipped(TestDescriptor testDescriptor, java.lang.String reason)
Description copied from interface:EngineExecutionListener
Must be called when the execution of a leaf or subtree of the test tree has been skipped.The
TestDescriptor
may represent a test or a container. In the case of a container, engines must not fire any additional events for its descendants.A skipped test or subtree of tests must not be reported as started or finished.
- Specified by:
executionSkipped
in interfaceEngineExecutionListener
- Parameters:
testDescriptor
- the descriptor of the skipped test or containerreason
- a human-readable message describing why the execution has been skipped
-
executionFinished
public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult)
Description copied from interface:EngineExecutionListener
Must be called when the execution of a leaf or subtree of the test tree has finished, regardless of the outcome.The
TestDescriptor
may represent a test or a container.This method may only be called if the test or container has not been skipped.
This method must be called for a container
TestIdentifier
after all of its children have been skipped or have finished.The
TestExecutionResult
describes the result of the execution for the suppliedtestDescriptor
. The result does not include or aggregate the results of its children. For example, a container with a failing test must be reported asSUCCESSFUL
even if one or more of its children are reported asFAILED
.- Specified by:
executionFinished
in interfaceEngineExecutionListener
- Parameters:
testDescriptor
- the descriptor of the finished test or containertestExecutionResult
- the (unaggregated) result of the execution for the suppliedTestDescriptor
- See Also:
TestExecutionResult
-
reportingEntryPublished
public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry)
Description copied from interface:EngineExecutionListener
Can be called for anyTestDescriptor
in order to publish additional information to the reporting infrastructure — for example:- Output that would otherwise go to
System.out
- Information about test context or test data
The current lifecycle state of the supplied
TestDescriptor
is not relevant: reporting events can occur at any time.- Specified by:
reportingEntryPublished
in interfaceEngineExecutionListener
- Parameters:
testDescriptor
- the descriptor of the test or container to which the reporting entry belongsentry
- aReportEntry
instance to be published
- Output that would otherwise go to
-
getTestIdentifier
private TestIdentifier getTestIdentifier(TestDescriptor testDescriptor)
-
-