Package org.verifyica.api
Class Cleanup
java.lang.Object
org.verifyica.api.Cleanup
Class to implement Cleanup
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThrows the first Throwable if not emptyclear()Removes any collected ThrowablesClose a Closable if not nullClose an array of CloseablesgetFirst()Get the first ThrowableGet the List of ThrowablesbooleanisEmpty()Returns if the Cleanup has collected any ThrowablesbooleanReturns if the Cleanup has not collected any Throwablesperform(Cleanup.Action action) Performs a Cleanup.Action, collecting the Throwable if thrownperform(Cleanup.Action... actions) Performs an array of Cleanup.Actions, collecting the Throwables if thrown
-
Constructor Details
-
Cleanup
public Cleanup()Constructor
-
-
Method Details
-
perform
Performs a Cleanup.Action, collecting the Throwable if thrown- Parameters:
action- executable- Returns:
- this
-
perform
Performs an array of Cleanup.Actions, collecting the Throwables if thrown- Parameters:
actions- executables- Returns:
- this
-
close
Close a Closable if not null- Parameters:
closeable- closable- Returns:
- this
-
close
Close an array of Closeables- Parameters:
closeables- closeables- Returns:
- this
-
isEmpty
public boolean isEmpty()Returns if the Cleanup has collected any Throwables- Returns:
- true if no Throwables have been collected, else false
-
isNotEmpty
public boolean isNotEmpty()Returns if the Cleanup has not collected any Throwables- Returns:
- true if no Throwables have been collected, else false
-
getThrowables
Get the List of Throwables- Returns:
- a List of Throwables
-
getFirst
Get the first Throwable- Returns:
- if a Throwable was thrown, an Optional that contains the first Throwable, else Optional.empty()
-
assertEmpty
Throws the first Throwable if not empty- Returns:
- this
- Throws:
Throwable- Throwable
-
clear
Removes any collected Throwables- Returns:
- this
-