TUM CCSM Commons

edu.tum.cs.commons.assertion
Class CCSMAssert

java.lang.Object
  extended by edu.tum.cs.commons.assertion.CCSMAssert

public class CCSMAssert
extends java.lang.Object

This class provides simple methods to implement assertions. Please refer to the package documentation for a discussion of assertions vs preconditions.

Version:
$Rev: 26283 $
Author:
deissenb, $Author: juergens $
Rating:
GREEN Hash: E82E611F994E400B617A0A0BB1D27C39

Constructor Summary
CCSMAssert()
           
 
Method Summary
static void fail(java.lang.String message)
           
static void isFalse(boolean condition, java.lang.String message)
          Checks if a condition is false.
static void isInstanceOf(java.lang.Object object, java.lang.Class<?> clazz)
          Checks that the object is a instance of the class
static void isNotNull(java.lang.Object reference)
          Checks whether a reference is null.
static void isNotNull(java.lang.Object reference, java.lang.String message)
          Checks whether a reference is null.
static void isTrue(boolean condition, java.lang.String message)
          Checks if a condition is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCSMAssert

public CCSMAssert()
Method Detail

isTrue

public static void isTrue(boolean condition,
                          java.lang.String message)
                   throws java.lang.AssertionError
Checks if a condition is true.

Parameters:
condition - condition to check
message - exception message
Throws:
java.lang.AssertionError - if the condition if false

isFalse

public static void isFalse(boolean condition,
                           java.lang.String message)
                    throws java.lang.AssertionError
Checks if a condition is false.

Parameters:
condition - condition to check
message - exception message
Throws:
java.lang.AssertionError - if the condition if true

isInstanceOf

public static void isInstanceOf(java.lang.Object object,
                                java.lang.Class<?> clazz)
Checks that the object is a instance of the class


fail

public static void fail(java.lang.String message)
                 throws java.lang.AssertionError
Throws:
java.lang.AssertionError - with message

isNotNull

public static void isNotNull(java.lang.Object reference)
                      throws java.lang.AssertionError
Checks whether a reference is null.

Parameters:
reference - reference to check
Throws:
java.lang.AssertionError - if the reference is null

isNotNull

public static void isNotNull(java.lang.Object reference,
                             java.lang.String message)
                      throws java.lang.AssertionError
Checks whether a reference is null.

Parameters:
reference - reference to check
message - exception message
Throws:
java.lang.AssertionError - if the reference is null

TUM CCSM Commons

TUM CCSM Commons - 2.7