Class CheckerRunnable
- All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Runnable,
CheckerRunnable>, Runnable>
A specialized checker for
Runnable
instances, providing a fluent API for validating
function behavior and results. This class allows assertions such as verifying that a function does not throw
exceptions, produces expected results, or returns non-null values for given inputs.
Example usage:
CheckerRunnable checker = CheckerRunnable.check(() -> {}) .runWithoutException();
- See Also:
-
Field Summary
Fields inherited from class util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckerRunnable
(Runnable runnable, String name) Constructs a newCheckerRunnable
with the specified runnable and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerRunnable
Creates a newCheckerRunnable
for the givenRunnable
instance with a default name.static CheckerRunnable
Creates a newCheckerRunnable
for the givenRunnable
instance with a custom name.Asserts that running theRunnable
does not throw any exception.protected CheckerRunnable
self()
Returns this checker instance (for fluent API usage).Methods inherited from class util.AbstractChecker
checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, show, showNotThrownException, showThrownException, stop
-
Constructor Details
-
CheckerRunnable
Constructs a newCheckerRunnable
with the specified runnable and name.- Parameters:
runnable
- theCheckerRunnable
to be used by this checkername
- the name identifying this checker
-
-
Method Details
-
check
Creates a newCheckerRunnable
for the givenRunnable
instance with a custom name.- Parameters:
runnable
- theRunnable
instance to be checkedname
- the name to identify this checker instance (useful for error messages)- Returns:
- a new
CheckerRunnable
for the providedRunnable
-
check
Creates a newCheckerRunnable
for the givenRunnable
instance with a default name.- Parameters:
runnable
- theRunnable
instance to be checked- Returns:
- a new
CheckerRunnable
for the providedRunnable
-
self
Returns this checker instance (for fluent API usage).- Specified by:
self
in classAbstractChecker<Runnable,
CheckerRunnable> - Returns:
- this
CheckerRunnable
instance
-
runWithoutException
Asserts that running theRunnable
does not throw any exception.- Returns:
- this
CheckerRunnable
instance for further validation
-