Class CheckerBiConsumer<T,U>

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

public class CheckerBiConsumer<T,U> extends AbstractChecker<BiConsumer<T,U>,CheckerBiConsumer<T,U>>
A specialized checker for BiConsumer instances, providing fluent API methods to assert various behaviors and properties of a BiConsumer, such as exception safety, input modification, and no-op behavior. Supports optional deep cloning of inputs before passing them to the BiConsumer under test.

Typical usage:


 CheckerBiConsumer<MyType, OtherType> checker = CheckerBiConsumer.check(myBiConsumer)
     .activateDeepClone()
     .applyWithoutException(input1, input2)
     .modifiesInput(input1, input2, condition1, condition2);
 
See Also:
  • Constructor Details

    • CheckerBiConsumer

      protected CheckerBiConsumer(BiConsumer<T,U> consumer, String name)
      Constructs a new CheckerBiConsumer with the specified BiConsumer and name.
      Parameters:
      consumer - the BiConsumer to be wrapped and checked
      name - the name identifying this checker
  • Method Details

    • check

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

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

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

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

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

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

      public CheckerBiConsumer<T,U> applyWithoutException(Collection<? extends Map.Entry<T,U>> input)
      Checks that the BiConsumer can be applied to all entries in the collection without throwing an exception.
      Parameters:
      input - the collection of key-value entries to test
      Returns:
      this CheckerBiConsumer instance
    • modifiesInput

      public CheckerBiConsumer<T,U> modifiesInput(T input1, U input2, Predicate<T> condition1, Predicate<U> condition2)
      Checks that the BiConsumer modifies the inputs as expected, according to the given predicates.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      condition1 - the predicate to test the first input after consumption
      condition2 - the predicate to test the second input after consumption
      Returns:
      this CheckerBiConsumer instance
    • modifiesInput

      public CheckerBiConsumer<T,U> modifiesInput(T input1, U input2, BiPredicate<T,U> condition)
      Checks that the BiConsumer modifies the inputs as expected, according to the given bi-predicate.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      condition - the bi-predicate to test both inputs after consumption
      Returns:
      this CheckerBiConsumer instance
    • modifiesInput

      public CheckerBiConsumer<T,U> modifiesInput(Collection<? extends Map.Entry<T,U>> input, Predicate<T> condition1, Predicate<U> condition2)
      Checks that the BiConsumer modifies all entries in the collection as expected, according to the given predicates.
      Parameters:
      input - the collection of key-value entries to test
      condition1 - the predicate to test the first input after consumption
      condition2 - the predicate to test the second input after consumption
      Returns:
      this CheckerBiConsumer instance
    • modifiesInput

      public CheckerBiConsumer<T,U> modifiesInput(Collection<? extends Map.Entry<T,U>> input, BiPredicate<T,U> condition)
      Checks that the BiConsumer modifies all entries in the collection as expected, according to the given bi-predicate.
      Parameters:
      input - the collection of key-value entries to test
      condition - the bi-predicate to test both inputs after consumption
      Returns:
      this CheckerBiConsumer instance
    • doesNothing

      public CheckerBiConsumer<T,U> doesNothing(T input1, U input2)
      Checks that the BiConsumer does not modify the given inputs.
      Parameters:
      input1 - the first input value
      input2 - the second input value
      Returns:
      this CheckerBiConsumer instance
    • doesNothing

      public CheckerBiConsumer<T,U> doesNothing(Collection<? extends Map.Entry<T,U>> input)
      Checks that the BiConsumer does not modify any of the entries in the collection.
      Parameters:
      input - the collection of key-value entries to test
      Returns:
      this CheckerBiConsumer instance