Constructor and Description |
---|
ThrowableCollector() |
Modifier and Type | Method and Description |
---|---|
void |
assertEmpty()
Assert that this
ThrowableCollector is empty (i.e.,
has not collected any Throwables ). |
void |
execute(Executable executable)
Execute the supplied
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 ). |
public void execute(Executable executable)
Executable
and collect any Throwable
thrown during the execution.executable
- 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
.
Throwable
or null
if this
ThrowableCollector
is emptyisEmpty()
,
assertEmpty()
public boolean isEmpty()
ThrowableCollector
is empty (i.e.,
has not collected any Throwables
).public boolean isNotEmpty()
ThrowableCollector
is not empty (i.e.,
has collected at least one Throwable
).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.