Class FlatPrintingListener
- java.lang.Object
-
- org.junit.platform.console.tasks.FlatPrintingListener
-
- All Implemented Interfaces:
DetailsPrintingListener
,TestExecutionListener
class FlatPrintingListener extends java.lang.Object implements DetailsPrintingListener
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private ColorPalette
colorPalette
(package private) static java.lang.String
INDENTATION
private java.io.PrintWriter
out
-
Fields inherited from interface org.junit.platform.console.tasks.DetailsPrintingListener
LINE_START_PATTERN
-
-
Constructor Summary
Constructors Constructor Description FlatPrintingListener(java.io.PrintWriter out, ColorPalette colorPalette)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dynamicTestRegistered(TestIdentifier testIdentifier)
Called when a new, dynamicTestIdentifier
has been registered.void
executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult)
Called when the execution of a leaf or subtree of theTestPlan
has finished, regardless of the outcome.void
executionSkipped(TestIdentifier testIdentifier, java.lang.String reason)
Called when the execution of a leaf or subtree of theTestPlan
has been skipped.void
executionStarted(TestIdentifier testIdentifier)
Called when the execution of a leaf or subtree of theTestPlan
is about to be started.private static java.lang.String
indented(java.lang.String message)
Indent the given message if it is a multi-line string.void
listTests(TestPlan testPlan)
private void
println(Style style, java.lang.String format, java.lang.Object... args)
private void
printlnException(Style style, java.lang.Throwable throwable)
private void
printlnMessage(Style style, java.lang.String message, java.lang.String detail)
private void
printlnTestDescriptor(Style style, java.lang.String message, TestIdentifier testIdentifier)
void
reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry entry)
Called when additional test reporting data has been published for the suppliedTestIdentifier
.void
testPlanExecutionFinished(TestPlan testPlan)
Called when the execution of theTestPlan
has finished, after all tests have been executed.void
testPlanExecutionStarted(TestPlan testPlan)
Called when the execution of theTestPlan
has started, before any test has been executed.
-
-
-
Field Detail
-
INDENTATION
static final java.lang.String INDENTATION
- See Also:
- Constant Field Values
-
out
private final java.io.PrintWriter out
-
colorPalette
private final ColorPalette colorPalette
-
-
Constructor Detail
-
FlatPrintingListener
FlatPrintingListener(java.io.PrintWriter out, ColorPalette colorPalette)
-
-
Method Detail
-
testPlanExecutionStarted
public void testPlanExecutionStarted(TestPlan testPlan)
Description copied from interface:TestExecutionListener
Called when the execution of theTestPlan
has started, before any test has been executed.Called from the same thread as
TestExecutionListener.testPlanExecutionFinished(TestPlan)
.- Specified by:
testPlanExecutionStarted
in interfaceTestExecutionListener
- Parameters:
testPlan
- describes the tree of tests about to be executed
-
testPlanExecutionFinished
public void testPlanExecutionFinished(TestPlan testPlan)
Description copied from interface:TestExecutionListener
Called when the execution of theTestPlan
has finished, after all tests have been executed.Called from the same thread as
TestExecutionListener.testPlanExecutionStarted(TestPlan)
.- Specified by:
testPlanExecutionFinished
in interfaceTestExecutionListener
- Parameters:
testPlan
- describes the tree of tests that have been executed
-
dynamicTestRegistered
public void dynamicTestRegistered(TestIdentifier testIdentifier)
Description copied from interface:TestExecutionListener
Called when a new, dynamicTestIdentifier
has been registered.A dynamic test is a test that is not known a-priori and therefore not contained in the original
TestPlan
.- Specified by:
dynamicTestRegistered
in interfaceTestExecutionListener
- Parameters:
testIdentifier
- the identifier of the newly registered test or container
-
executionSkipped
public void executionSkipped(TestIdentifier testIdentifier, java.lang.String reason)
Description copied from interface:TestExecutionListener
Called when the execution of a leaf or subtree of theTestPlan
has been skipped.The
TestIdentifier
may represent a test or a container. In the case of a container, no listener methods will be called for any of its descendants.A skipped test or subtree of tests will never be reported as started or finished.
- Specified by:
executionSkipped
in interfaceTestExecutionListener
- Parameters:
testIdentifier
- the identifier of the skipped test or containerreason
- a human-readable message describing why the execution has been skipped
-
executionStarted
public void executionStarted(TestIdentifier testIdentifier)
Description copied from interface:TestExecutionListener
Called when the execution of a leaf or subtree of theTestPlan
is about to be started.The
TestIdentifier
may represent a test or a container.This method will only be called if the test or container has not been skipped.
This method will be called for a container
TestIdentifier
before starting or skipping any of its children.- Specified by:
executionStarted
in interfaceTestExecutionListener
- Parameters:
testIdentifier
- the identifier of the started test or container
-
executionFinished
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult)
Description copied from interface:TestExecutionListener
Called when the execution of a leaf or subtree of theTestPlan
has finished, regardless of the outcome.The
TestIdentifier
may represent a test or a container.This method will only be called if the test or container has not been skipped.
This method will 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 suppliedTestIdentifier
. The result does not include or aggregate the results of its children. For example, a container with a failing test will be reported asSUCCESSFUL
even if one or more of its children are reported asFAILED
.- Specified by:
executionFinished
in interfaceTestExecutionListener
- Parameters:
testIdentifier
- the identifier of the finished test or containertestExecutionResult
- the (unaggregated) result of the execution for the suppliedTestIdentifier
- See Also:
TestExecutionResult
-
reportingEntryPublished
public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry entry)
Description copied from interface:TestExecutionListener
Called when additional test reporting data has been published for the suppliedTestIdentifier
.Can be called at any time during the execution of a test plan.
- Specified by:
reportingEntryPublished
in interfaceTestExecutionListener
- Parameters:
testIdentifier
- describes the test or container to which the entry pertainsentry
- the publishedReportEntry
-
printlnTestDescriptor
private void printlnTestDescriptor(Style style, java.lang.String message, TestIdentifier testIdentifier)
-
printlnException
private void printlnException(Style style, java.lang.Throwable throwable)
-
printlnMessage
private void printlnMessage(Style style, java.lang.String message, java.lang.String detail)
-
println
private void println(Style style, java.lang.String format, java.lang.Object... args)
-
indented
private static java.lang.String indented(java.lang.String message)
Indent the given message if it is a multi-line string.INDENTATION
is used to prefix the start of each new line except the first one.- Parameters:
message
- the message to indent- Returns:
- indented message
-
listTests
public void listTests(TestPlan testPlan)
- Specified by:
listTests
in interfaceDetailsPrintingListener
-
-