public static final class FWDTestEngine.FWDThrowableCollector
extends org.junit.platform.engine.support.hierarchical.OpenTest4JAwareThrowableCollector
ThrowableCollector which handles RuntimeExceptions which wrap
AssertionFailedError in the exception cause chain specially.
Note: unfortunately, the data code in this class duplicates most of the parent class
data and code.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Throwable |
throwable
Store the first
Throwable thrown, all subsequent
throwables if any, are added to the first one as suppressed. |
| Constructor and Description |
|---|
FWDThrowableCollector()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertEmpty()
Assert that this
ThrowableCollector is empty (i.e.,
has not collected any Throwables). |
void |
execute(org.junit.platform.engine.support.hierarchical.ThrowableCollector.Executable executable)
Execute the supplied
ThrowableCollector.Executable and collect any Throwable
thrown during the execution. |
java.lang.Throwable |
getThrowable()
Get the first
Throwable collected by this
ThrowableCollector. |
boolean |
isEmpty()
Determine if this
ThrowableCollector is empty (i.e.,
has not collected any Throwables). |
boolean |
isNotEmpty()
Determine if this
ThrowableCollector is not empty (i.e.,
has collected at least one Throwable). |
org.junit.platform.engine.TestExecutionResult |
toTestExecutionResult()
Convert the collected
Throwables into a TestExecutionResult. |
private java.lang.Throwable throwable
Throwable thrown, all subsequent
throwables if any, are added to the first one as suppressed.public void assertEmpty()
ThrowableCollector is empty (i.e.,
has not collected any Throwables).
If this collector is not empty, the first collected Throwable
will be thrown with any additional Throwables
suppressed in the
first Throwable. Note, however, that the Throwable
will not be wrapped. Rather, it will be
masked
as an unchecked exception.
assertEmpty in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorgetThrowable(),
ExceptionUtils.throwAsUncheckedException(Throwable)public void execute(org.junit.platform.engine.support.hierarchical.ThrowableCollector.Executable executable)
ThrowableCollector.Executable and collect any Throwable
thrown during the execution.
If the Executable throws an unrecoverable exception
— for example, an OutOfMemoryError — this method will
rethrow it.
execute in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorexecutable - the Executable to executeassertEmpty()public java.lang.Throwable getThrowable()
Throwable collected by this
ThrowableCollector.
If this collector is not empty, the first collected Throwable
will be returned with any additional Throwables
suppressed in the
first Throwable.
If the first collected Throwable aborted execution
and at least one later collected Throwable failed
execution, the first failing Throwable will be returned
with the previous aborting and any additional Throwables
suppressed inside.
getThrowable in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorThrowable or null if this
ThrowableCollector is emptyisEmpty(),
assertEmpty()public boolean isEmpty()
ThrowableCollector is empty (i.e.,
has not collected any Throwables).isEmpty in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorpublic boolean isNotEmpty()
ThrowableCollector is not empty (i.e.,
has collected at least one Throwable).isNotEmpty in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorpublic org.junit.platform.engine.TestExecutionResult toTestExecutionResult()
Throwables into a TestExecutionResult.toTestExecutionResult in class org.junit.platform.engine.support.hierarchical.ThrowableCollectorThrowable aborted execution;
failed if it failed
execution; and successful
otherwise