Class Truth

java.lang.Object
com.helixframework.assertion.Truth

public final class Truth extends Object
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 Details

    • isTruthy

      public static boolean isTruthy(String value)
      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

      public static void ifTruthy(String value, Runnable action)
      Executes a specified action if the provided string value is considered truthy.
      Parameters:
      value - the string value to evaluate for truthiness
      action - the action to execute if the value is truthy
    • ifTruthy

      public static void ifTruthy(Supplier<Boolean> condition, Runnable action)
      Executes a specified action if the provided condition evaluates to true.
      Parameters:
      condition - the supplier function that evaluates to a boolean value
      action - the action to execute if the condition evaluates to true
    • isFalsy

      public static boolean isFalsy(String value)
      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

      public static void ifFalsy(String value, Runnable action)
      Executes a specified action if the provided string value is considered falsy.
      Parameters:
      value - the string value to evaluate for falsiness
      action - the action to execute if the value is falsy
    • ifFalsy

      public static void ifFalsy(Supplier<Boolean> condition, Runnable action)
      Executes a specified action if the provided condition evaluates to false.
      Parameters:
      condition - the supplier function that evaluates to a boolean value
      action - the action to execute if the condition evaluates to false