Package org.eclipse.persistence.jpa.jpql
Class Assert
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.Assert
-
public final class Assert extends java.lang.Object
An utility class that provides various checks and when the condition fails, then anAssert.AssertException
is thrown.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Assert.AssertException
The exception thrown when the condition is not met.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
fail(java.lang.String message)
Throws anAssert.AssertException
immediately.static void
isEqual(java.lang.Object object1, java.lang.Object object2, java.lang.String message)
Determines whether the given two objects are equal (identity).static void
isFalse(boolean condition, java.lang.String message)
Determines whether the given condition iffalse
ortrue
and if it istrue
then anAssert.AssertException
is thrown.static void
isNotNull(java.lang.Object object, java.lang.String message)
Determines whether the given object is notnull
.static void
isNull(java.lang.Object object, java.lang.String message)
Determines whether the given object isnull
.static void
isTrue(boolean condition, java.lang.String message)
Determines whether the given condition iftrue
orfalse
and if it isfalse
then anAssert.AssertException
is thrown.static void
isValid(java.lang.Object object, java.lang.String message, java.lang.Object... choices)
Determines whether the given object is one of the given choices using identity check.
-
-
-
Method Detail
-
fail
public static void fail(java.lang.String message)
Throws anAssert.AssertException
immediately.- Parameters:
message
- The message to display
-
isEqual
public static void isEqual(java.lang.Object object1, java.lang.Object object2, java.lang.String message)
Determines whether the given two objects are equal (identity). If the two objects are not identical, then anAssert.AssertException
is thrown- Parameters:
object1
- The first object used to be compared to the second objectobject2
- The second object used to be compared to the first objectmessage
- The expression's message that will describe the reason why the check failed
-
isFalse
public static void isFalse(boolean condition, java.lang.String message)
Determines whether the given condition iffalse
ortrue
and if it istrue
then anAssert.AssertException
is thrown.- Parameters:
condition
- The condition to verify it isfalse
message
- The expression's message that will describe the reason why the check failed
-
isNotNull
public static void isNotNull(java.lang.Object object, java.lang.String message)
Determines whether the given object is notnull
. If the object isnull
, then anNullPointerException
is thrown- Parameters:
object
- The value to check to not benull
message
- The expression's message that will describe the reason why the check failed
-
isNull
public static void isNull(java.lang.Object object, java.lang.String message)
Determines whether the given object isnull
. If the object is notnull
, then anAssert.AssertException
is thrown- Parameters:
object
- The value to check to benull
message
- The expression's message that will describe the reason why the check failed
-
isTrue
public static void isTrue(boolean condition, java.lang.String message)
Determines whether the given condition iftrue
orfalse
and if it isfalse
then anAssert.AssertException
is thrown.- Parameters:
condition
- The condition to verify it istrue
message
- The expression's message that will describe the reason why the check failed
-
isValid
public static void isValid(java.lang.Object object, java.lang.String message, java.lang.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 choicesmessage
- The expression's message that will describe the reason why the check failedchoices
- The list of valid choices
-
-