Class CheckerRunnable
java.lang.Object
com.luchersol.core.util.AbstractChecker<Runnable,CheckerRunnable>
com.luchersol.core.specialized_checkers.lambda.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 com.luchersol.core.util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckerRunnable(Runnable runnable, String name) Constructs a newCheckerRunnablewith the specified runnable and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerRunnableCreates a newCheckerRunnablefor the givenRunnableinstance with a default name.static CheckerRunnableCreates a newCheckerRunnablefor the givenRunnableinstance with a custom name.Asserts that running theRunnabledoes not throw any exception.protected CheckerRunnableself()Returns this checker instance (for fluent API usage).Methods inherited from class com.luchersol.core.util.AbstractChecker
checkProperty, checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, setBackObject, setExceptionTracker, setName, setObject, setSaveErrors, setStop, show, showPassedChecks, showThrownException, stop, toChecker, updateChecker
-
Constructor Details
-
CheckerRunnable
Constructs a newCheckerRunnablewith the specified runnable and name.- Parameters:
runnable- theCheckerRunnableto be used by this checkername- the name identifying this checker
-
-
Method Details
-
check
Creates a newCheckerRunnablefor the givenRunnableinstance with a custom name.- Parameters:
runnable- theRunnableinstance to be checkedname- the name to identify this checker instance (useful for error messages)- Returns:
- a new
CheckerRunnablefor the providedRunnable
-
check
Creates a newCheckerRunnablefor the givenRunnableinstance with a default name.- Parameters:
runnable- theRunnableinstance to be checked- Returns:
- a new
CheckerRunnablefor the providedRunnable
-
self
Returns this checker instance (for fluent API usage).- Specified by:
selfin classAbstractChecker<Runnable,CheckerRunnable> - Returns:
- this
CheckerRunnableinstance
-
runWithoutException
Asserts that running theRunnabledoes not throw any exception.- Returns:
- this
CheckerRunnableinstance for further validation
-