Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.collab.util
Class Assert

    java.lang.Object
      com.compoze.collab.util.Assert

    public class Assert

extends Object

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

### isEnabled

    public static boolean isEnabled()

  Are assertions enabled?

  Returns
    Returns whether assertions are enabled.

### setEnabled

    public static void setEnabled(boolean bEnabled)

  Parameters
    `assertionsEnabled` - The m_bAssertEnabled to set.

### isTrue

    public static void isTrue(boolean bAssertion,
                              String sMessage)
                       throws AssertException

  Test that `bAssertion` is `true`.

  Parameters
    `bAssertion` - the value to check
    `sMessage` - message for the AssertException
  Throws
    `AssertException` - if bAssertion is `false`

### isTrue

    public static void isTrue(boolean bAssertion,
                              String sMessage,
                              Object value)
                       throws AssertException

  Test that `bAssertion` is `true`. Provide a value to append to the end of the AssertException message.

  Parameters
    `bAssertion` - the value to check
    `sMessage` - message for the AssertException
    `value` - value to append to end of sMessage
  Throws
    `AssertException` - if bAssertion is `false`

### isTrue

    public static void isTrue(boolean bAssertion,
                              String sMessage,
                              long value)
                       throws AssertException

  Test that `bAssertion` is `true`. Provide a value to append to the end of the AssertException message.

  Parameters
    `bAssertion` - the value to check
    `sMessage` - message for the AssertException
    `value` - value to append to end of sMessage
  Throws
    `AssertException` - if bAssertion is `false`

### isTrue

    public static void isTrue(boolean bAssertion,
                              String sMessage,
                              double value)
                       throws AssertException

  Test that `bAssertion` is `true`. Provide a value to append to the end of the AssertException message.

  Parameters
    `bAssertion` - the value to check
    `sMessage` - message for the AssertException
    `value` - value to append to end of sMessage
  Throws
    `AssertException` - if bAssertion is `false`

### isTrue

    public static void isTrue(boolean bAssertion,
                              String sMessage,
                              char value)
                       throws AssertException

  Test that `bAssertion` is `true`. Provide a value to append to the end of the AssertException message.

  Parameters
    `bAssertion` - the value to check
    `sMessage` - message for the AssertException
    `value` - value to append to end of sMessage
  Throws
    `AssertException` - if bAssertion is `false`

### failure

    public static void failure(String sMessage)
                        throws AssertException

  Use this method when the code reaches an illegal state. Will throw an AssertException unless assertions are disabled.

  Parameters
    `sMessage` - message for the AssertException
  Throws
    `AssertException`

### main

    public static void main(String[] args)

  Class exerciser.

  Parameters
    `args` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 BEA Systems, Inc. All Rights Reserved