Class CheckerBiPredicate<T,U>

java.lang.Object
util.AbstractChecker<BiPredicate<T,U>,CheckerBiPredicate<T,U>>
specialized_checkers.lambda.CheckerBiPredicate<T,U>
Type Parameters:
T - the type of the first argument to the BiPredicate
U - the type of the second argument to the BiPredicate
All Implemented Interfaces:
InterfaceChecker<AbstractChecker<BiPredicate<T,U>,CheckerBiPredicate<T,U>>,BiPredicate<T,U>>

public class CheckerBiPredicate<T,U> extends AbstractChecker<BiPredicate<T,U>,CheckerBiPredicate<T,U>>
A specialized checker for BiPredicate instances, providing a fluent API to verify their behavior with optional deep cloning of input arguments.

This class allows for testing whether a BiPredicate can be applied without exceptions, whether it evaluates to true or false for specific inputs, and whether it produces an expected result. Deep cloning of inputs can be enabled to ensure immutability during checks.

  • Constructor Details

    • CheckerBiPredicate

      protected CheckerBiPredicate(BiPredicate<T,U> biPredicate, String name)
      Constructs a new CheckerBiPredicate with the specified BiPredicate and name.
      Parameters:
      biPredicate - the BiPredicate logic to be used by this checker
      name - the name identifying this checker
  • Method Details

    • check

      public static <T, U> CheckerBiPredicate<T,U> check(BiPredicate<T,U> bipredicate, String name)
      Creates a CheckerBiPredicate for the given BiPredicate and assigns a custom name.
      Type Parameters:
      T - the type of the first input to the BiPredicate being checked
      U - the type of the second input to the BiPredicate being checked
      Parameters:
      bipredicate - the BiPredicate to check
      name - the name to assign to this checker
      Returns:
      a CheckerBiPredicate instance for the given BiPredicate
    • check

      public static <T, U> CheckerBiPredicate<T,U> check(BiPredicate<T,U> bipredicate)
      Creates a CheckerBiPredicate for the given BiPredicate with a default name.
      Type Parameters:
      T - the type of the first input to the BiPredicate being checked
      U - the type of the second input to the BiPredicate being checked
      Parameters:
      bipredicate - the BiPredicate to check
      Returns:
      a CheckerBiPredicate instance for the given BiPredicate
    • self

      protected CheckerBiPredicate<T,U> self()
      Returns this instance (for fluent API).
      Specified by:
      self in class AbstractChecker<BiPredicate<T,U>,CheckerBiPredicate<T,U>>
      Returns:
      this CheckerBiPredicate instance
    • activateDeepClone

      public CheckerBiPredicate<T,U> activateDeepClone()
      Activates deep cloning of inputs before passing them to the BiPredicate.
      Returns:
      this CheckerBiPredicate instance
    • deactivateDeepClone

      public CheckerBiPredicate<T,U> deactivateDeepClone()
      Deactivates deep cloning of inputs before passing them to the BiPredicate.
      Returns:
      this CheckerBiPredicate instance
    • testWithoutException

      public CheckerBiPredicate<T,U> testWithoutException(T input1, U input2)
      Checks that the BiPredicate can be applied to the given inputs without throwing an exception.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      Returns:
      this CheckerBiPredicate instance
    • evaluatesTrue

      public CheckerBiPredicate<T,U> evaluatesTrue(T input1, U input2)
      Checks that the BiPredicate evaluates to true for the given inputs.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      Returns:
      this CheckerBiPredicate instance
    • evaluatesFalse

      public CheckerBiPredicate<T,U> evaluatesFalse(T input1, U input2)
      Checks that the BiPredicate evaluates to false for the given inputs.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      Returns:
      this CheckerBiPredicate instance
    • producesExpected

      public CheckerBiPredicate<T,U> producesExpected(T input1, U input2, boolean expected)
      Checks that the BiPredicate produces the expected boolean result for the given inputs.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      expected - the expected boolean result
      Returns:
      this CheckerBiPredicate instance