public final class Assert extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkArgument(boolean condition)
If the
condition is false, the method throws
IllegalArgumentException. |
static void |
checkArgument(boolean condition,
String errorMessage)
If the
condition is false, the method throws
IllegalArgumentException. |
static String |
checkNotBlank(String string,
String stringName)
Returns given string if it is not "blank" (i.e. it is not
null and does not contain just whitespace characters). |
static void |
checkState(boolean condition)
If the
condition is false, the method throws
IllegalStateException. |
static void |
checkState(boolean condition,
String errorMessage)
If the
condition is false, the method throws
IllegalStateException. |
public static void checkArgument(boolean condition)
condition is false, the method throws
IllegalArgumentException.condition - condition to checkIllegalArgumentException - if condition is falsepublic static void checkArgument(boolean condition,
String errorMessage)
condition is false, the method throws
IllegalArgumentException.condition - condition to checkerrorMessage - error messageIllegalArgumentException - if condition is falsepublic static void checkState(boolean condition)
condition is false, the method throws
IllegalStateException.condition - condition to checkIllegalStateException - if condition is falsepublic static void checkState(boolean condition,
String errorMessage)
condition is false, the method throws
IllegalStateException.condition - condition to checkerrorMessage - error messageIllegalStateException - if condition is falsepublic static String checkNotBlank(String string, String stringName)
null and does not contain just whitespace characters).string - the string to check if it is not blankstringName - the name of the string variable that is checked (used for
displaying in a thrown exception)NullPointerException - (unchecked)
if the string argument is nullIllegalArgumentException - (unchecked)
if the string argument contains just whitespace
charactersCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.