Class Assert

java.lang.Object
org.eclipse.persistence.jpa.jpql.Assert

public final class Assert extends Object
An utility class that provides various checks and when the condition fails, then an Assert.AssertException is thrown.
Version:
2.4
Author:
Pascal Filion
  • Method Details

    • fail

      public static void fail(String message)
      Throws an Assert.AssertException immediately.
      Parameters:
      message - The message to display
    • isEqual

      public static void isEqual(Object object1, Object object2, String message)
      Determines whether the given two objects are equal (identity). If the two objects are not identical, then an Assert.AssertException is thrown
      Parameters:
      object1 - The first object used to be compared to the second object
      object2 - The second object used to be compared to the first object
      message - The expression's message that will describe the reason why the check failed
    • isFalse

      public static void isFalse(boolean condition, String message)
      Determines whether the given condition if false or true and if it is true then an Assert.AssertException is thrown.
      Parameters:
      condition - The condition to verify it is false
      message - The expression's message that will describe the reason why the check failed
    • isNotNull

      public static void isNotNull(Object object, String message)
      Determines whether the given object is not null. If the object is null, then an NullPointerException is thrown
      Parameters:
      object - The value to check to not be null
      message - The expression's message that will describe the reason why the check failed
    • isNull

      public static void isNull(Object object, String message)
      Determines whether the given object is null. If the object is not null, then an Assert.AssertException is thrown
      Parameters:
      object - The value to check to be null
      message - The expression's message that will describe the reason why the check failed
    • isTrue

      public static void isTrue(boolean condition, String message)
      Determines whether the given condition if true or false and if it is false then an Assert.AssertException is thrown.
      Parameters:
      condition - The condition to verify it is true
      message - The expression's message that will describe the reason why the check failed
    • isValid

      public static void isValid(Object object, String message, Object... choices)
      Determines whether the given object is one of the given choices using identity check.
      Parameters:
      object - The object to find in the list of choices
      message - The expression's message that will describe the reason why the check failed
      choices - The list of valid choices