|
Copyright © 2006 BEA Systems, Inc. All Rights Reserved | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.compoze.collab.util.Assert
public class Assert
A class to perform assertion checks. If assertions are enabled, throws an AssertExceptions if an assertion is false. Example:
Assert.isTrue( foo > 0, "foo must be positive. foo=", foo );If the test asserted is expensive or your assertion message requires String concatenation, only do the assertion if Assert.isEnabled():
if ( Assert.isEnabled() )
Assert.isTrue( isFactorable(largeNumber), "largeNumber must not be prime" );
| Method Summary | |
|---|---|
static void |
failure(String sMessage)
Use this method when the code reaches an illegal state. |
static boolean |
isEnabled()
Are assertions enabled? |
static void |
isTrue(boolean bAssertion,
String sMessage)
Test that bAssertion is true. |
static void |
isTrue(boolean bAssertion,
String sMessage,
char value)
Test that bAssertion is true. |
static void |
isTrue(boolean bAssertion,
String sMessage,
double value)
Test that bAssertion is true. |
static void |
isTrue(boolean bAssertion,
String sMessage,
long value)
Test that bAssertion is true. |
static void |
isTrue(boolean bAssertion,
String sMessage,
Object value)
Test that bAssertion is true. |
static void |
main(String[] args)
Class exerciser. |
static void |
setEnabled(boolean bEnabled)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isEnabled()
public static void setEnabled(boolean bEnabled)
assertionsEnabled - The m_bAssertEnabled to set.
public static void isTrue(boolean bAssertion,
String sMessage)
throws AssertException
bAssertion is true.
bAssertion - the value to checksMessage - message for the AssertException
AssertException - if bAssertion is false
public static void isTrue(boolean bAssertion,
String sMessage,
Object value)
throws AssertException
bAssertion is true. Provide a value
to append to the end of the AssertException message.
bAssertion - the value to checksMessage - message for the AssertExceptionvalue - value to append to end of sMessage
AssertException - if bAssertion is false
public static void isTrue(boolean bAssertion,
String sMessage,
long value)
throws AssertException
bAssertion is true. Provide a value
to append to the end of the AssertException message.
bAssertion - the value to checksMessage - message for the AssertExceptionvalue - value to append to end of sMessage
AssertException - if bAssertion is false
public static void isTrue(boolean bAssertion,
String sMessage,
double value)
throws AssertException
bAssertion is true. Provide a value
to append to the end of the AssertException message.
bAssertion - the value to checksMessage - message for the AssertExceptionvalue - value to append to end of sMessage
AssertException - if bAssertion is false
public static void isTrue(boolean bAssertion,
String sMessage,
char value)
throws AssertException
bAssertion is true. Provide a value
to append to the end of the AssertException message.
bAssertion - the value to checksMessage - message for the AssertExceptionvalue - value to append to end of sMessage
AssertException - if bAssertion is false
public static void failure(String sMessage)
throws AssertException
sMessage - message for the AssertException
AssertExceptionpublic static void main(String[] args)
args -
|
Copyright © 2006 BEA Systems, Inc. All Rights Reserved | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||