Class CheckerRunnable

java.lang.Object
util.AbstractChecker<Runnable,CheckerRunnable>
specialized_checkers.lambda.CheckerRunnable
All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Runnable,CheckerRunnable>,Runnable>

public class CheckerRunnable extends AbstractChecker<Runnable,CheckerRunnable>
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:
  • Constructor Details

    • CheckerRunnable

      protected CheckerRunnable(Runnable runnable, String name)
      Constructs a new CheckerRunnable with the specified runnable and name.
      Parameters:
      runnable - the CheckerRunnable to be used by this checker
      name - the name identifying this checker
  • Method Details

    • check

      public static CheckerRunnable check(Runnable runnable, String name)
      Creates a new CheckerRunnable for the given Runnable instance with a custom name.
      Parameters:
      runnable - the Runnable instance to be checked
      name - the name to identify this checker instance (useful for error messages)
      Returns:
      a new CheckerRunnable for the provided Runnable
    • check

      public static CheckerRunnable check(Runnable runnable)
      Creates a new CheckerRunnable for the given Runnable instance with a default name.
      Parameters:
      runnable - the Runnable instance to be checked
      Returns:
      a new CheckerRunnable for the provided Runnable
    • self

      protected CheckerRunnable self()
      Returns this checker instance (for fluent API usage).
      Specified by:
      self in class AbstractChecker<Runnable,CheckerRunnable>
      Returns:
      this CheckerRunnable instance
    • runWithoutException

      public CheckerRunnable runWithoutException()
      Asserts that running the Runnable does not throw any exception.
      Returns:
      this CheckerRunnable instance for further validation