Class AssertTool

java.lang.Object
com.xxl.tool.core.AssertTool

public class AssertTool extends Object
  • Constructor Details

    • AssertTool

      public AssertTool()
  • Method Details

    • isTrue

      public static void isTrue(boolean expression, String message)
      Assert a boolean expression, throwing an IllegalArgumentException if the expression evaluates to false.
           Assert.isTrue(i > 0, "The value must be greater than zero");
       
      Parameters:
      expression - a boolean expression
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if expression is false
    • isFalse

      public static void isFalse(boolean expression, String message)
      Assert that a boolean expression evaluating to false is true.
      Parameters:
      expression - a boolean expression
      message - the exception message to use if the assertion fails
    • isNull

      public static void isNull(Object object, String message)
      Assert that an object is null.
           Assert.isNull(value, "The value must be null");
       
      Parameters:
      object - the object to check
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if the object is not null
    • notNull

      public static void notNull(Object object, String message)
      Assert that an object is not null.
           Assert.notNull(clazz, "The class must not be null");
       
      Parameters:
      object - the object to check
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if the object is null
    • isBlank

      public static void isBlank(String str, String message)
      Assert that a string is blank.
      Parameters:
      str - the string to check
      message - the exception message to use if the assertion fails
    • notBlank

      public static void notBlank(String str, String message)
      Assert that a string is not blank.
      Parameters:
      str - the string to check
      message - the exception message to use if the assertion fails