public final class Assert extends Object
AssertFailedException when the assertion fails. All methods are static.| Modifier and Type | Method and Description |
|---|---|
static void |
isFalse(boolean condition,
String message)
Verify that condition is false.
|
static void |
isNull(Object arg,
String argName)
Verify that arg is null.
|
static void |
isTrue(boolean condition,
String message)
Verify that condition is true.
|
static void |
notNull(Object arg,
String argName)
Verify that arg is not null.
|
static void |
notNullOrEmpty(Collection collection,
String argName)
Verify that the collection is not null or empty.
|
static void |
notNullOrEmpty(Map map,
String argName)
Verify that the Map is not null or empty.
|
static void |
notNullOrEmpty(Object[] array,
String argName)
Verify that the array is not null or empty.
|
static void |
notNullOrEmpty(String string,
String argName)
Verify that the String is not null or empty.
|
public static void isNull(Object arg, String argName)
arg - - the method parameter valueargName - - the name of the parameter; used in the exception messageAssertFailedException - - if arg is not nullpublic static void notNull(Object arg, String argName)
arg - - the method parameter valueargName - - the name of the parameter; used in the exception messageAssertFailedException - - if arg is nullpublic static void isTrue(boolean condition,
String message)
condition - - the condition that should be truemessage - - the error message if the condition is falseAssertFailedException - - if condition is falsepublic static void isFalse(boolean condition,
String message)
condition - - the condition that should be falsemessage - - the error message if the condition is trueAssertFailedException - - if condition is truepublic static void notNullOrEmpty(Collection collection, String argName)
collection - - the CollectionargName - - the name of the parameter; used in the exception messageAssertFailedException - - if collection is null or emptypublic static void notNullOrEmpty(Map map, String argName)
map - - the MapargName - - the name of the parameter; used in the exception messageAssertFailedException - - if map is null or emptypublic static void notNullOrEmpty(Object[] array, String argName)
array - - the arrayargName - - the name of the parameter; used in the exception messageAssertFailedException - - if array is null or emptypublic static void notNullOrEmpty(String string, String argName)
string - - the StringargName - - the name of the parameter; used in the exception messageAssertFailedException - - if string is null or emptyCopyright © 2016. All rights reserved.