Package com.helixframework.assertion
Class Truth
java.lang.Object
com.helixframework.assertion.Truth
The Truth class provides methods for checking the truthiness of a given string value.
The Truth class is a utility class and cannot be instantiated.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidExecutes a specified action if the provided string value is considered falsy.static voidExecutes a specified action if the provided condition evaluates to false.static voidExecutes a specified action if the provided string value is considered truthy.static voidExecutes a specified action if the provided condition evaluates to true.static booleanDetermines if the given string value is falsy.static booleanChecks if a given string value is truthy.
-
Method Details
-
isTruthy
Checks if a given string value is truthy.- Parameters:
value- the string value to check- Returns:
- true if the value is not null, not empty, and equals "Y", "YES", "TRUE", or "1"; false otherwise
-
ifTruthy
Executes a specified action if the provided string value is considered truthy.- Parameters:
value- the string value to evaluate for truthinessaction- the action to execute if the value is truthy
-
ifTruthy
Executes a specified action if the provided condition evaluates to true.- Parameters:
condition- the supplier function that evaluates to a boolean valueaction- the action to execute if the condition evaluates to true
-
isFalsy
Determines if the given string value is falsy.A string value is considered falsy if it is not null, not empty, and equals "N", "NO", "FALSE", or "0".
- Parameters:
value- the string value to check- Returns:
- true if the value is falsy, false otherwise
-
ifFalsy
Executes a specified action if the provided string value is considered falsy.- Parameters:
value- the string value to evaluate for falsinessaction- the action to execute if the value is falsy
-
ifFalsy
Executes a specified action if the provided condition evaluates to false.- Parameters:
condition- the supplier function that evaluates to a boolean valueaction- the action to execute if the condition evaluates to false
-