Assertpublic class Assert extends Object Use Assert to checkpoint conditions within the code. |
Methods Summary |
---|
public static final void | assertRange(int value, int min, int max, java.lang.Object msgIn)
assertRange( (long)value, (long)min, (long)max, msgIn );
| public static final void | assertRange(long value, long min, long max, java.lang.Object msgIn)
if ( value < min || value > max )
{
String rangeString = "[" + min + ", " + max + "]";
String msg = "illegal integer value = " + value +
" must be in range " + rangeString;
if ( msgIn != null )
{
msg += " ( " + msgIn + " )";
}
throwIt( msg );
}
| public static final void | assertit(boolean assertIsTrue, java.lang.Object msg)If expression is false, throw an AssertError which
incorporates the message.
If expression is true, do nothing.
if ( ! assertIsTrue )
{
throwIt( msg.toString() );
}
| private static final void | throwIt(java.lang.String msg)
AssertError e = new AssertError( msg );
// always print it here, so it will be seen
e.printStackTrace();
throw e;
|
|