|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.common.util.Assertion
The class Assertion may be used to increase the software quality
by testing for pre- and postconditions in method calls. An assertion consists
of an atomic test for a certain condition that may fail.
If an assertion fails, the exception AssertException is thrown.
Example:
Assertion.check(arg1 > 0 && arg1 <= 100, "range must be between 0 and 100");
| Method Summary | |
static void |
check(boolean condition,
java.lang.String message)
This assertion method fails, when the given condition argument is false. |
static void |
checkInterval(int lowerBound,
int value,
int upperBound,
java.lang.String message)
Checks, if the given value lies in the specified interval. |
static void |
checkNotNull(java.lang.Object object,
java.lang.String description)
This assertion method fails, when the given object is null. |
static void |
checkNull(java.lang.Object object,
java.lang.String description)
This assertion method fails, when the given object is non- null. |
static void |
fail(java.lang.String message)
This assertion method always fails. |
static void |
fail(java.lang.String message,
java.lang.Throwable cause)
This assertion method always fails. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void check(boolean condition,
java.lang.String message)
false.
condition - the condition that must be truemessage - the message, that describes the assertion
public static void checkNotNull(java.lang.Object object,
java.lang.String description)
null.
object - the object, that must be non-nulldescription - the description of the value to be checkedcheckNull(java.lang.Object, java.lang.String)
public static void checkNull(java.lang.Object object,
java.lang.String description)
null.
object - the object, that must be nulldescription - the description of the value to be checkedcheckNotNull(java.lang.Object, java.lang.String)
public static void checkInterval(int lowerBound,
int value,
int upperBound,
java.lang.String message)
lowerBound - the lower boundvalue - the value to checkupperBound - the upper boundmessage - the message for the assertionpublic static void fail(java.lang.String message)
message - the message, that describes the reason for the failure
public static void fail(java.lang.String message,
java.lang.Throwable cause)
message - the message that describes the reason for the failurecause - the cause for the failure
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||