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 voidassertEmpty()Assert that thisThrowableCollectoris empty (i.e., has not collected anyThrowables).voidexecute(Executable executable)Execute the suppliedExecutableand collect anyThrowablethrown during the execution.ThrowablegetThrowable()Get the firstThrowablecollected by thisThrowableCollector.booleanisEmpty()Determine if thisThrowableCollectoris empty (i.e., has not collected anyThrowables).booleanisNotEmpty()Determine if thisThrowableCollectoris not empty (i.e., has collected at least oneThrowable).
-
-
-
Method Detail
-
execute
public void execute(Executable executable)
Execute the suppliedExecutableand collect anyThrowablethrown during the execution.- Parameters:
executable- theExecutableto execute- See Also:
assertEmpty()
-
getThrowable
public Throwable getThrowable()
Get the firstThrowablecollected by thisThrowableCollector.If this collector is not empty, the first collected
Throwablewill be returned with any additional throwables suppressed in the firstThrowable.- Returns:
- the first collected
Throwableornullif thisThrowableCollectoris empty - See Also:
isEmpty(),assertEmpty()
-
isEmpty
public boolean isEmpty()
Determine if thisThrowableCollectoris empty (i.e., has not collected anyThrowables).
-
isNotEmpty
public boolean isNotEmpty()
Determine if thisThrowableCollectoris not empty (i.e., has collected at least oneThrowable).
-
assertEmpty
public void assertEmpty()
Assert that thisThrowableCollectoris empty (i.e., has not collected anyThrowables).If this collector is not empty, the first collected
Throwablewill be thrown with any additional throwables suppressed in the firstThrowable. Note, however, that theThrowablewill not be wrapped. Rather, it will be masked as an unchecked exception.
-
-