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
-
ENABLED
- True if assert methods are enabled.
-
assert(boolean)
- Assert that the boolean condition
b
is true.
-
assert(boolean, String)
- Assert that the boolean condition
b
is true.
-
assert(long)
- Assert that the long parameter
l
is not zero.
-
assert(long, String)
- Assert that the long parameter
l
is not zero.
-
assert(Object)
- Assert that the object reference
l
is not
null
.
-
assert(Object, String)
- Assert that the object reference
l
is not
null
.
ENABLED
public static final boolean ENABLED
- True if assert methods are enabled.
assert
public static final void assert(boolean b)
- Assert that the boolean condition
b
is true.
- Parameters:
- b - The boolean condition to check.
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.
assert
public static final void assert(long l)
- Assert that the long parameter
l
is not zero.
- Parameters:
- l - The long value to check.
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.
assert
public static final void assert(Object ref)
- Assert that the object reference
l
is not
null
.
- Parameters:
- ref - The object reference to check.
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.