Package dev.paseto.jpaseto.lang
Class Assert
- java.lang.Object
-
- dev.paseto.jpaseto.lang.Assert
-
public final class Assert extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidhasText(java.lang.String text, java.lang.String message)Assert that the given String has valid text content; that is, it must not benulland must contain at least one non-whitespace character.static voidisTrue(boolean expression, java.lang.String message)Assert a boolean expression, throwingIllegalArgumentExceptionif the test result isfalse.static voidnotNull(java.lang.Object object, java.lang.String message)Assert that an object is notnull.
-
-
-
Method Detail
-
isTrue
public static void isTrue(boolean expression, java.lang.String message)Assert a boolean expression, throwingIllegalArgumentExceptionif the test result isfalse.Assert.isTrue(i > 0, "The value must be greater than zero");
- Parameters:
expression- a boolean expressionmessage- the exception message to use if the assertion fails- Throws:
java.lang.IllegalArgumentException- if expression isfalse
-
notNull
public static void notNull(java.lang.Object object, java.lang.String message)Assert that an object is notnull.Assert.notNull(clazz, "The class must not be null");
- Parameters:
object- the object to checkmessage- the exception message to use if the assertion fails- Throws:
java.lang.IllegalArgumentException- if the object isnull
-
hasText
public static void hasText(java.lang.String text, java.lang.String message)Assert that the given String has valid text content; that is, it must not benulland must contain at least one non-whitespace character.Assert.hasText(name, "'name' must not be empty");
- Parameters:
text- the String to checkmessage- the exception message to use if the assertion fails- See Also:
Strings.hasText(java.lang.CharSequence)
-
-