Class Assert

java.lang.Object
   |
   +----Assert

public final class Assert
extends Object
A class that acts like the C/C++ assertion macro. For a detailed description of this topic look at http://www.afu.com/javafaq.html and search for "11.6 How can I write C/C++ style assertions in Java?". All assert methods throw an AssertException, if the asserted condition is not true and the "Enable assertions" checkbox was selected while creating the class from the template.

See Also:
AssertionException

Variable Index

 o ENABLED
True if assert methods are enabled.

Method Index

 o assert(boolean)
Assert that the boolean condition b is true.
 o assert(boolean, String)
Assert that the boolean condition b is true.
 o assert(long)
Assert that the long parameter l is not zero.
 o assert(long, String)
Assert that the long parameter l is not zero.
 o assert(Object)
Assert that the object reference l is not null.
 o assert(Object, String)
Assert that the object reference l is not null.

Variables

 o ENABLED
 public static final boolean ENABLED
True if assert methods are enabled.

Methods

 o assert
 public static final void assert(boolean b)
Assert that the boolean condition b is true.

Parameters:
b - The boolean condition to check.
 o assert
 public static final void assert(boolean b,
                                 String s)
Assert that the boolean condition b is true.

Parameters:
b - The boolean condition to check.
s - The detail message for the resulting exception.
 o assert
 public static final void assert(long l)
Assert that the long parameter l is not zero.

Parameters:
l - The long value to check.
 o assert
 public static final void assert(long l,
                                 String s)
Assert that the long parameter l is not zero.

Parameters:
l - The long value to check.
s - The detail message for the resulting exception.
 o assert
 public static final void assert(Object ref)
Assert that the object reference l is not null.

Parameters:
ref - The object reference to check.
 o assert
 public static final void assert(Object ref,
                                 String s)
Assert that the object reference l is not null.

Parameters:
ref - The object reference to check.
s - The detail message for the resulting exception.