Class ThrowableCollector
- java.lang.Object
-
- org.junit.jupiter.engine.execution.ThrowableCollector
-
-
Constructor Summary
Constructors Constructor Description ThrowableCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertEmpty()
Assert that thisThrowableCollector
is empty (i.e., has not collected anyThrowables
).void
execute(Executable executable)
Execute the suppliedExecutable
and collect anyThrowable
thrown during the execution.Throwable
getThrowable()
Get the firstThrowable
collected by thisThrowableCollector
.boolean
isEmpty()
Determine if thisThrowableCollector
is empty (i.e., has not collected anyThrowables
).boolean
isNotEmpty()
Determine if thisThrowableCollector
is not empty (i.e., has collected at least oneThrowable
).
-
-
-
Method Detail
-
execute
public void execute(Executable executable)
Execute the suppliedExecutable
and collect anyThrowable
thrown during the execution.- Parameters:
executable
- theExecutable
to execute- See Also:
assertEmpty()
-
getThrowable
public Throwable getThrowable()
Get the firstThrowable
collected by thisThrowableCollector
.If this collector is not empty, the first collected
Throwable
will be returned with any additional throwables suppressed in the firstThrowable
.- Returns:
- the first collected
Throwable
ornull
if thisThrowableCollector
is empty - See Also:
isEmpty()
,assertEmpty()
-
isEmpty
public boolean isEmpty()
Determine if thisThrowableCollector
is empty (i.e., has not collected anyThrowables
).
-
isNotEmpty
public boolean isNotEmpty()
Determine if thisThrowableCollector
is not empty (i.e., has collected at least oneThrowable
).
-
assertEmpty
public void assertEmpty()
Assert that thisThrowableCollector
is empty (i.e., has not collected anyThrowables
).If this collector is not empty, the first collected
Throwable
will be thrown with any additional throwables suppressed in the firstThrowable
. Note, however, that theThrowable
will not be wrapped. Rather, it will be masked as an unchecked exception.
-
-