util
Class Assert
java.lang.Object
|
+--util.Assert
- public class Assert
- extends Object
Class for assertions. Programmers can use this to raise runtime
exceptions if they like. Use code like
Assert.isEqual( obj1, obj2 );
If you use code like
Assert.isTrue( Assert.ON && test );
Then the code will only run if the ON constant is true (so we can
turn it off for production code).
Field Summary |
static boolean |
ON
|
Constructor Summary |
protected |
Assert()
|
Method Summary |
static void |
assert(String msg,
boolean test)
|
static void |
fail(String msg)
|
static void |
isEqual(Object a,
Object b)
|
static void |
isEqual(String msg,
Object a,
Object b)
|
static void |
isNull(Object a)
|
static void |
isNull(String msg,
Object a)
|
static void |
isSame(Object a,
Object b)
|
static void |
isSame(String msg,
Object a,
Object b)
|
static void |
isTrue(boolean test)
|
static void |
isTrue(String msg,
boolean test)
|
static void |
makeFatal()
|
static void |
makeSoft()
|
static void |
notNull(Object a)
|
static void |
notNull(String msg,
Object a)
|
static void |
shouldNotReachHere()
|
static void |
shouldNotReachHere(String str)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ON
public static final boolean ON
Assert
protected Assert()
makeFatal
public static void makeFatal()
makeSoft
public static void makeSoft()
assert
public static void assert(String msg,
boolean test)
isTrue
public static void isTrue(String msg,
boolean test)
isTrue
public static void isTrue(boolean test)
isEqual
public static void isEqual(String msg,
Object a,
Object b)
isEqual
public static void isEqual(Object a,
Object b)
isSame
public static void isSame(String msg,
Object a,
Object b)
isSame
public static void isSame(Object a,
Object b)
notNull
public static void notNull(String msg,
Object a)
notNull
public static void notNull(Object a)
isNull
public static void isNull(String msg,
Object a)
isNull
public static void isNull(Object a)
shouldNotReachHere
public static void shouldNotReachHere()
shouldNotReachHere
public static void shouldNotReachHere(String str)
fail
public static void fail(String msg)