Class RunListenerAdapter
- java.lang.Object
-
- org.apache.maven.surefire.junitplatform.RunListenerAdapter
-
- All Implemented Interfaces:
org.apache.maven.surefire.api.report.TestOutputReceiver<org.apache.maven.surefire.api.report.OutputReportEntry>,org.apache.maven.surefire.report.RunModeSetter,org.junit.platform.launcher.TestExecutionListener
final class RunListenerAdapter extends java.lang.Object implements org.junit.platform.launcher.TestExecutionListener, org.apache.maven.surefire.api.report.TestOutputReceiver<org.apache.maven.surefire.api.report.OutputReportEntry>, org.apache.maven.surefire.report.RunModeSetter- Since:
- 2.22.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRunListenerAdapter.ResultDisplay
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.surefire.report.ClassMethodIndexerclassMethodIndexerprivate java.util.concurrent.ConcurrentMap<org.junit.platform.launcher.TestIdentifier,org.junit.platform.engine.TestExecutionResult>failuresprivate org.apache.maven.surefire.api.report.TestReportListener<org.apache.maven.surefire.api.report.TestOutputReportEntry>runListenerprivate org.apache.maven.surefire.api.report.RunModerunModeprivate java.util.concurrent.ConcurrentMap<java.lang.String,org.junit.platform.launcher.TestIdentifier>runningTestIdentifiersByUniqueIdprivate org.apache.maven.surefire.api.report.Stoppablestoppableprivate org.junit.platform.launcher.TestPlantestPlanprivate java.util.concurrent.ConcurrentMap<org.junit.platform.launcher.TestIdentifier,java.lang.Long>testStartTime
-
Constructor Summary
Constructors Constructor Description RunListenerAdapter(org.apache.maven.surefire.api.report.TestReportListener<org.apache.maven.surefire.api.report.TestOutputReportEntry> runListener, org.apache.maven.surefire.api.report.Stoppable stoppable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.stream.Stream<org.junit.platform.launcher.TestIdentifier>collectAllTestIdentifiersInHierarchy(org.junit.platform.launcher.TestIdentifier testIdentifier)private java.lang.IntegercomputeElapsedTime(org.junit.platform.launcher.TestIdentifier testIdentifier)private org.apache.maven.surefire.api.report.SimpleReportEntrycreateReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier)private org.apache.maven.surefire.api.report.SimpleReportEntrycreateReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.lang.Integer elapsedTime)private org.apache.maven.surefire.api.report.SimpleReportEntrycreateReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.lang.String reason, java.lang.Integer elapsedTime)private org.apache.maven.surefire.api.report.SimpleReportEntrycreateReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.util.Map<java.lang.String,java.lang.String> systemProperties, java.lang.String reason, java.lang.Integer elapsedTime)voidexecutionFinished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult)voidexecutionSkipped(org.junit.platform.launcher.TestIdentifier testIdentifier, java.lang.String reason)voidexecutionStarted(org.junit.platform.launcher.TestIdentifier testIdentifier)private java.util.Optional<java.lang.String>findDisplayNameTagValue(org.junit.platform.launcher.TestIdentifier testIdentifier)private org.junit.platform.launcher.TestIdentifierfindFirstParentContainerAndSourceClass(org.junit.platform.launcher.TestIdentifier testIdentifier)private org.junit.platform.launcher.TestIdentifierfindTopParent(org.junit.platform.launcher.TestIdentifier testIdentifier)private voidfireStopEvent()(package private) java.util.Map<org.junit.platform.launcher.TestIdentifier,org.junit.platform.engine.TestExecutionResult>getFailures()(package private) booleanhasFailingTests()private booleanhasParentId(org.junit.platform.launcher.TestIdentifier testIdentifier)Checks if the test identifier has a parent ID but using reflection as it's only available from 1.8(package private) voidreset()private java.lang.StringsafeGetMessage(java.lang.Throwable throwable)voidsetRunMode(org.apache.maven.surefire.api.report.RunMode runMode)voidtestPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan)voidtestPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan)private RunListenerAdapter.ResultDisplaytoClassMethodName(org.junit.platform.launcher.TestIdentifier testIdentifier)[0] class name - used in stacktrace parser [1] class display name [2] method signature - used in stacktrace parser [3] method display nameprivate org.apache.maven.surefire.api.report.StackTraceWritertoStackTraceWriter(java.lang.String realClassName, java.lang.String realMethodName, java.lang.Throwable throwable)private org.apache.maven.surefire.api.report.StackTraceWritertoStackTraceWriter(java.lang.String realClassName, java.lang.String realMethodName, org.junit.platform.engine.TestExecutionResult testExecutionResult)voidwriteTestOutput(org.apache.maven.surefire.api.report.OutputReportEntry reportEntry)
-
-
-
Field Detail
-
classMethodIndexer
private final org.apache.maven.surefire.report.ClassMethodIndexer classMethodIndexer
-
testStartTime
private final java.util.concurrent.ConcurrentMap<org.junit.platform.launcher.TestIdentifier,java.lang.Long> testStartTime
-
failures
private final java.util.concurrent.ConcurrentMap<org.junit.platform.launcher.TestIdentifier,org.junit.platform.engine.TestExecutionResult> failures
-
runningTestIdentifiersByUniqueId
private final java.util.concurrent.ConcurrentMap<java.lang.String,org.junit.platform.launcher.TestIdentifier> runningTestIdentifiersByUniqueId
-
runListener
private final org.apache.maven.surefire.api.report.TestReportListener<org.apache.maven.surefire.api.report.TestOutputReportEntry> runListener
-
stoppable
private final org.apache.maven.surefire.api.report.Stoppable stoppable
-
testPlan
private volatile org.junit.platform.launcher.TestPlan testPlan
-
runMode
private volatile org.apache.maven.surefire.api.report.RunMode runMode
-
-
Method Detail
-
setRunMode
public void setRunMode(org.apache.maven.surefire.api.report.RunMode runMode)
- Specified by:
setRunModein interfaceorg.apache.maven.surefire.report.RunModeSetter
-
testPlanExecutionStarted
public void testPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan)
- Specified by:
testPlanExecutionStartedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
testPlanExecutionFinished
public void testPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan)
- Specified by:
testPlanExecutionFinishedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
executionStarted
public void executionStarted(org.junit.platform.launcher.TestIdentifier testIdentifier)
- Specified by:
executionStartedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
executionFinished
public void executionFinished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult)- Specified by:
executionFinishedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
computeElapsedTime
private java.lang.Integer computeElapsedTime(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
collectAllTestIdentifiersInHierarchy
private java.util.stream.Stream<org.junit.platform.launcher.TestIdentifier> collectAllTestIdentifiersInHierarchy(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
safeGetMessage
private java.lang.String safeGetMessage(java.lang.Throwable throwable)
-
executionSkipped
public void executionSkipped(org.junit.platform.launcher.TestIdentifier testIdentifier, java.lang.String reason)- Specified by:
executionSkippedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
createReportEntry
private org.apache.maven.surefire.api.report.SimpleReportEntry createReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.util.Map<java.lang.String,java.lang.String> systemProperties, java.lang.String reason, java.lang.Integer elapsedTime)
-
createReportEntry
private org.apache.maven.surefire.api.report.SimpleReportEntry createReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
createReportEntry
private org.apache.maven.surefire.api.report.SimpleReportEntry createReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.lang.Integer elapsedTime)
-
createReportEntry
private org.apache.maven.surefire.api.report.SimpleReportEntry createReportEntry(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult, java.lang.String reason, java.lang.Integer elapsedTime)
-
toStackTraceWriter
private org.apache.maven.surefire.api.report.StackTraceWriter toStackTraceWriter(java.lang.String realClassName, java.lang.String realMethodName, org.junit.platform.engine.TestExecutionResult testExecutionResult)
-
toStackTraceWriter
private org.apache.maven.surefire.api.report.StackTraceWriter toStackTraceWriter(java.lang.String realClassName, java.lang.String realMethodName, java.lang.Throwable throwable)
-
findTopParent
private org.junit.platform.launcher.TestIdentifier findTopParent(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
hasParentId
private boolean hasParentId(org.junit.platform.launcher.TestIdentifier testIdentifier)
Checks if the test identifier has a parent ID but using reflection as it's only available from 1.8- Parameters:
testIdentifier- the test identifier to check- Returns:
- true if the test identifier has a parent ID, false otherwise
-
findFirstParentContainerAndSourceClass
private org.junit.platform.launcher.TestIdentifier findFirstParentContainerAndSourceClass(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
toClassMethodName
private RunListenerAdapter.ResultDisplay toClassMethodName(org.junit.platform.launcher.TestIdentifier testIdentifier)
- [0] class name - used in stacktrace parser
- [1] class display name
- [2] method signature - used in stacktrace parser
- [3] method display name
- Parameters:
testIdentifier- a class or method- Returns:
- 4 elements string array
-
findDisplayNameTagValue
private java.util.Optional<java.lang.String> findDisplayNameTagValue(org.junit.platform.launcher.TestIdentifier testIdentifier)
-
getFailures
java.util.Map<org.junit.platform.launcher.TestIdentifier,org.junit.platform.engine.TestExecutionResult> getFailures()
- Returns:
- Map of tests that failed.
-
hasFailingTests
boolean hasFailingTests()
-
reset
void reset()
-
writeTestOutput
public void writeTestOutput(org.apache.maven.surefire.api.report.OutputReportEntry reportEntry)
- Specified by:
writeTestOutputin interfaceorg.apache.maven.surefire.api.report.TestOutputReceiver<org.apache.maven.surefire.api.report.OutputReportEntry>
-
fireStopEvent
private void fireStopEvent()
-
-