Class CheckerBiPredicate<T,U>
java.lang.Object
com.luchersol.core.util.AbstractChecker<BiPredicate<T,U>,CheckerBiPredicate<T,U>>
com.luchersol.core.specialized_checkers.lambda.CheckerBiPredicate<T,U>
- Type Parameters:
T- the type of the first argument to the BiPredicateU- 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.
-
Field Summary
Fields inherited from class com.luchersol.core.util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckerBiPredicate(BiPredicate<T, U> biPredicate, String name) Constructs a newCheckerBiPredicatewith the specifiedBiPredicateand name. -
Method Summary
Modifier and TypeMethodDescriptionActivates deep cloning of inputs before passing them to the BiPredicate.static <T,U> CheckerBiPredicate <T, U> check(BiPredicate<T, U> bipredicate) Creates a CheckerBiPredicate for the given BiPredicate with a default name.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.Deactivates deep cloning of inputs before passing them to the BiPredicate.evaluatesFalse(T input1, U input2) Checks that the BiPredicate evaluates to false for the given inputs.evaluatesTrue(T input1, U input2) Checks that the BiPredicate evaluates to true for the given inputs.producesExpected(T input1, U input2, boolean expected) Checks that the BiPredicate produces the expected boolean result for the given inputs.protected CheckerBiPredicate<T, U> self()Returns this instance (for fluent API).testWithoutException(T input1, U input2) Checks that the BiPredicate can be applied to the given inputs without throwing an exception.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
-
CheckerBiPredicate
Constructs a newCheckerBiPredicatewith the specifiedBiPredicateand name.- Parameters:
biPredicate- theBiPredicatelogic to be used by this checkername- the name identifying this checker
-
-
Method Details
-
check
Creates a CheckerBiPredicate for the given BiPredicate and assigns a custom name.- Type Parameters:
T- the type of the first input to theBiPredicatebeing checkedU- the type of the second input to theBiPredicatebeing checked- Parameters:
bipredicate- the BiPredicate to checkname- the name to assign to this checker- Returns:
- a CheckerBiPredicate instance for the given BiPredicate
-
check
Creates a CheckerBiPredicate for the given BiPredicate with a default name.- Type Parameters:
T- the type of the first input to theBiPredicatebeing checkedU- the type of the second input to theBiPredicatebeing checked- Parameters:
bipredicate- the BiPredicate to check- Returns:
- a CheckerBiPredicate instance for the given BiPredicate
-
self
Returns this instance (for fluent API).- Specified by:
selfin classAbstractChecker<BiPredicate<T,U>, CheckerBiPredicate<T, U>> - Returns:
- this CheckerBiPredicate instance
-
activateDeepClone
Activates deep cloning of inputs before passing them to the BiPredicate.- Returns:
- this CheckerBiPredicate instance
-
deactivateDeepClone
Deactivates deep cloning of inputs before passing them to the BiPredicate.- Returns:
- this CheckerBiPredicate instance
-
testWithoutException
Checks that the BiPredicate can be applied to the given inputs without throwing an exception.- Parameters:
input1- the first input valueinput2- the second input value- Returns:
- this CheckerBiPredicate instance
-
evaluatesTrue
Checks that the BiPredicate evaluates to true for the given inputs.- Parameters:
input1- the first input valueinput2- the second input value- Returns:
- this CheckerBiPredicate instance
-
evaluatesFalse
Checks that the BiPredicate evaluates to false for the given inputs.- Parameters:
input1- the first input valueinput2- the second input value- Returns:
- this CheckerBiPredicate instance
-
producesExpected
Checks that the BiPredicate produces the expected boolean result for the given inputs.- Parameters:
input1- the first input valueinput2- the second input valueexpected- the expected boolean result- Returns:
- this CheckerBiPredicate instance
-