|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.metasyntactic.debug.Assert
Assertions are boolean expressions that the programmer believes to be true concerning the state of a computer program. For example, after sorting a list, the programmer might assert that the list is in ascending order. Evaluating assertions at runtime to confirm their validity is one of the most powerful tools for improving code quality, as it quickly uncovers the programmer's misconceptions concerning a program's behavior.
| Field Summary | |
static boolean |
OFF
Value to pass to setState to turn sssertions off |
static boolean |
ON
Value to pass to setState to turn sssertions on |
| Method Summary | |
static void |
assert(boolean expression)
Asserts that the value of expression in true. |
static void |
assert(boolean expression,
java.lang.String message)
Asserts that the value of expression in true. |
static boolean |
getState()
Returns whether or not assertions are on or off |
static void |
reverseState()
Turns assertions off if they are on, or on if they are off |
static void |
setState(boolean state)
Sets the state of the assertions cased on value passed in |
static void |
turnOff()
Turns assertions off |
static void |
turnOn()
Turns assertions on |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static boolean ON
public static boolean OFF
| Method Detail |
public static void reverseState()
public static void turnOn()
public static void turnOff()
public static boolean getState()
ON or OFFpublic static void setState(boolean state)
state - ON or OFF
public static void assert(boolean expression)
throws AssertionException
expression - The expression that you are asserting is true
AssertionException - if expression is false
public static void assert(boolean expression,
java.lang.String message)
throws AssertionException
expression - The expression you are asserting is truemessage - The message you want the assertion exception to contain
if it is thrown
AssertionException - if expression is false
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||