org.eclipse.swtbot.swt.finder.utils.internal
Class Assert

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.utils.internal.Assert

public final class Assert
extends Object

Copy of Assert, moved here to reduce dependency on org.eclipse.equinox.common.


Method Summary
static boolean isLegal(boolean expression)
          Asserts that an argument is legal.
static boolean isLegal(boolean expression, Object message)
          Asserts that an argument is legal.
static void isNotEmpty(Object... toCheck)
          Asserts that the given list is not empty or null.
static void isNotNull(Object object)
          Asserts that the given object is not null.
static void isNotNull(Object object, Object message)
          Asserts that the given object is not null.
static void isTrue(boolean expression)
          Asserts that the given boolean is true.
static void isTrue(boolean expression, Object message)
          Asserts that the given boolean is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLegal

public static boolean isLegal(boolean expression)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown.

Parameters:
expression - the outcode of the check
Returns:
true if the check passes (does not return if the check fails)
Throws:
IllegalArgumentException - if the legality test failed

isLegal

public static boolean isLegal(boolean expression,
                              Object message)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown. The given message is included in that exception, to aid debugging.

Parameters:
expression - the outcode of the check
message - the message to include in the exception
Returns:
true if the check passes (does not return if the check fails)
Throws:
IllegalArgumentException - if the legality test failed

isNotNull

public static void isNotNull(Object object)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown.

Parameters:
object - the value to test

isNotNull

public static void isNotNull(Object object,
                             Object message)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.

Parameters:
object - the value to test
message - the message to include in the exception

isTrue

public static void isTrue(boolean expression)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown.

Parameters:
expression - the outcode of the check

isTrue

public static void isTrue(boolean expression,
                          Object message)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.

Parameters:
expression - the outcode of the check
message - the message to include in the exception

isNotEmpty

public static void isNotEmpty(Object... toCheck)
Asserts that the given list is not empty or null. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.

Parameters:
expression - the outcode of the check
message - the message to include in the exception