public class Assert extends Object
The methods are generally of the form: methodXXX(message, expression). If the expression fails the assertion, then the AssertionException is created using the specified message and then thrown.
Constructor and Description |
---|
Assert() |
Modifier and Type | Method and Description |
---|---|
static void |
greaterThanZero(int evalInt)
Fails the assertion if the integer is not greater than zero.
|
static void |
greaterThanZero(String intDescription,
int evalInt)
Fails the assertion if the integer is not greater than zero.
|
static void |
isFalse(boolean expression)
Fails the assertion if the specified expression is true.
|
static void |
isFalse(String expressionDescription,
boolean expression)
Fails the assertion if the specified expression is true.
|
static void |
isTrue(boolean expression)
Fails the assertion if the specified expression is false.
|
static void |
isTrue(String expressionDescription,
boolean expression)
Fails the assertion if the specified expression is false.
|
static void |
notNegative(int evalInt)
Fails the assertion if the integer is less than zero.
|
static void |
notNegative(String intDescription,
int evalInt)
Fails the assertion if the integer is less than zero.
|
static void |
notNull(Object evalObj)
Fails the assertion if the specified object is null.
|
static void |
notNull(String objDescription,
Object evalObj)
Fails the assertion if the specified object is null.
|
static void |
notNullOrEmpty(String evalString)
Fails the assertion if the specified string is null or empty.
|
static void |
notNullOrEmpty(String stringDescription,
String evalString)
Fails the assertion if the specified string is null or empty.
|
static void |
shouldNotReach()
Automatically throws an AssertionException.
|
static void |
shouldNotReach(String message)
Automatically throws an AssertionException using the specified message.
|
public Assert()
public static void isTrue(String expressionDescription, boolean expression)
public static void isTrue(boolean expression)
public static void isFalse(String expressionDescription, boolean expression)
public static void isFalse(boolean expression)
public static void notNull(Object evalObj)
public static void notNull(String objDescription, Object evalObj)
public static void notNullOrEmpty(String evalString)
public static void notNullOrEmpty(String stringDescription, String evalString)
stringDescription
- A description of the string being evaluated.evalString
- The string to evaluate.public static void notNegative(int evalInt)
evalInt
- The integer to evaluate.public static void notNegative(String intDescription, int evalInt)
intDescription
- A description of the integer being evaluated.evalInt
- The integer to evaluate.public static void greaterThanZero(int evalInt)
evalInt
- The integer to evaluate.public static void greaterThanZero(String intDescription, int evalInt)
intDescription
- A description of the integer being evaluated.evalInt
- The integer to evaluate.public static void shouldNotReach()
public static void shouldNotReach(String message)
EnvGen available from www.basilv.com/psd/software Copyright © 2007 Basil Vandegriend. All Rights Reserved.