Class Require

java.lang.Object
com.helixframework.assertion.Require

public final class Require extends Object
Runtime assertion helper.
  • Field Details

    • SUPPRESS_ASSERTION_ERRORS_SYSTEM_PROP

      public static final String SUPPRESS_ASSERTION_ERRORS_SYSTEM_PROP
      System property that when set to anything, but false, will result in failed assertions being logged instead of raising exceptions.
      See Also:
  • Method Details

    • nonNullValue

      public static void nonNullValue(Object obj)
      Requires that the object is not null.
      Parameters:
      obj - object to check
    • nonNullValue

      public static void nonNullValue(Object obj, String message)
      Requires that the object is not null.
      Parameters:
      obj - object to check
      message - error message
    • nonNullValues

      public static void nonNullValues(Object... objs)
      Requires that all objects are not null.
      Parameters:
      objs - objects to check
    • nullValue

      public static void nullValue(Object obj)
      Requires that the object is null.
      Parameters:
      obj - object to check
    • nullValue

      public static void nullValue(Object obj, String message)
      Requires that the object is null.
      Parameters:
      obj - object to check
      message - error message
    • nullValues

      public static void nullValues(Object... objs)
      Requires that all objects are null.
      Parameters:
      objs - objects to check
    • notEmpty

      public static void notEmpty(Collection<?> collection)
      Requires that the collection is not empty.
      Parameters:
      collection - collection to check
    • notEmpty

      public static void notEmpty(Collection<?> collection, String message)
      Requires that the collection is not empty.
      Parameters:
      collection - collection to check
      message - error message
    • notEmpty

      public static void notEmpty(String value)
      Requires that the string is not null or empty.
      Parameters:
      value - string to check
    • notEmpty

      public static void notEmpty(String value, String message)
      Requires that the string not null or empty.
      Parameters:
      value - string to check
      message - error messaage
    • empty

      public static void empty(Collection<?> collection)
      Requires that the collection is empty.
      Parameters:
      collection - collection to check
    • empty

      public static void empty(Collection<?> collection, String message)
      Requires that the collection is empty.
      Parameters:
      collection - collection to check
      message - error message
    • size

      public static void size(Collection<?> collection, int size)
      Requires that the collection is a specific size.
      Parameters:
      collection - collection to check
      size - collection size
    • size

      public static void size(Collection<?> collection, int size, String message)
      Requires that the collection is a specific size.
      Parameters:
      collection - collection to check
      size - collection size
      message - error message
    • instanceOf

      public static void instanceOf(Object obj, Class<?> type)
      Requires that the object is an instance of the type.
      Parameters:
      obj - object to check
      type - instance type
    • instanceOf

      public static void instanceOf(Object obj, Class<?> type, String message)
      Requires that the object is an instance of the type.
      Parameters:
      obj - object to check
      type - instance type
      message - error message
    • isTrue

      public static void isTrue(Supplier<Boolean> func, String message)
      Requires that the function evaluates true.
      Parameters:
      func - function
      message - error message
    • isTrue

      public static void isTrue(boolean value)
      Requires that the boolean statement is true.
      Parameters:
      value - boolean to check
    • isTrue

      public static void isTrue(boolean value, String message)
      Requires that the boolean statement is true.
      Parameters:
      value - boolean to check
      message - error message
    • isFalse

      public static void isFalse(Supplier<Boolean> func, String message)
      Requires that the function evaluates false.
      Parameters:
      func - function
      message - error message
    • isFalse

      public static void isFalse(boolean value)
      Requires that the boolean statement is false.
      Parameters:
      value - boolean to check
    • isFalse

      public static void isFalse(boolean value, String message)
      Requires that the boolean statement is false.
      Parameters:
      value - boolean to check
      message - error message