org.jtiger.assertion
Class Basic

java.lang.Object
  extended by org.jtiger.assertion.Basic

public final class Basic
extends Object

Provides the ability to make assertions that are of the most basic and trivial concepts.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris

Method Summary
static void assertEqual(boolean[] expected, boolean[] actual, Object... message)
          Asserts that the given expected boolean array argument is equal to the actual boolean array argument.
static void assertEqual(byte[] expected, byte[] actual, Object... message)
          Asserts that the given expected byte array argument is equal to the actual byte array argument.
static void assertEqual(char[] expected, char[] actual, Object... message)
          Asserts that the given expected char array argument is equal to the actual char array argument.
static void assertEqual(double[] expected, double[] actual, Object... message)
          Asserts that the given expected double array argument is equal to the actual double array argument.
static void assertEqual(float[] expected, float[] actual, Object... message)
          Asserts that the given expected float array argument is equal to the actual float array argument.
static void assertEqual(int[] expected, int[] actual, Object... message)
          Asserts that the given expected int array argument is equal to the actual int array argument.
static void assertEqual(long[] expected, long[] actual, Object... message)
          Asserts that the given expected long array argument is equal to the actual long array argument.
static void assertEqual(Object[] expected, Object[] actual, Object... message)
          Asserts that the given expected Object array argument is equal to the actual Object array argument.
static void assertEqual(Object expected, Object actual, Object... message)
          Asserts that the given expected Object argument is equal to the actual Object argument.
static void assertEqual(short[] expected, short[] actual, Object... message)
          Asserts that the given expected short array argument is equal to the actual short array argument.
static void assertFalse(boolean b, Object... message)
          Asserts that the given boolean argument is true.
static void assertNotEqual(boolean[] expected, boolean[] actual, Object... message)
          Asserts that the given expected boolean array argument is not equal to the actual boolean array argument.
static void assertNotEqual(byte[] expected, byte[] actual, Object... message)
          Asserts that the given expected byte array argument is not equal to the actual byte array argument.
static void assertNotEqual(char[] expected, char[] actual, Object... message)
          Asserts that the given expected char array argument is not equal to the actual char array argument.
static void assertNotEqual(double[] expected, double[] actual, Object... message)
          Asserts that the given expected double array argument is not equal to the actual double array argument.
static void assertNotEqual(float[] expected, float[] actual, Object... message)
          Asserts that the given expected float array argument is not equal to the actual float array argument.
static void assertNotEqual(int[] expected, int[] actual, Object... message)
          Asserts that the given expected int array argument is not equal to the actual int array argument.
static void assertNotEqual(long[] expected, long[] actual, Object... message)
          Asserts that the given expected long array argument is not equal to the actual long array argument.
static void assertNotEqual(Object[] expected, Object[] actual, Object... message)
          Asserts that the given expected Object array argument is not equal to the actual Object array argument.
static void assertNotEqual(Object expected, Object actual, Object... message)
          Asserts that the given expected Object argument is not equal to the actual Object argument.
static void assertNotEqual(short[] expected, short[] actual, Object... message)
          Asserts that the given expected short array argument is not equal to the actual short array argument.
static void assertNotNull(Object o, Object... message)
          Asserts that the given Object argument is not null.
static void assertNotSame(Object expected, Object actual, Object... message)
          Asserts that the given expected Object argument is not referring to the same object as the actual Object argument.
static void assertNull(Object o, Object... message)
          Asserts that the given Object argument is null.
static void assertSame(Object expected, Object actual, Object... message)
          Asserts that the given expected Object argument is referring to the same object as the actual Object argument.
static void assertTrue(boolean b, Object... message)
          Asserts that the given boolean argument is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertTrue

public static void assertTrue(boolean b,
                              Object... message)
                       throws AssertionException
Asserts that the given boolean argument is true.

Parameters:
b - The argument to assert is true.
message - The assertion message.
Throws:
AssertionException - If the given boolean argument is not true.

assertFalse

public static void assertFalse(boolean b,
                               Object... message)
                        throws AssertionException
Asserts that the given boolean argument is true.

Parameters:
b - The argument to assert is true.
message - The assertion message.
Throws:
AssertionException - If the given boolean argument is not true.

assertNull

public static void assertNull(Object o,
                              Object... message)
                       throws AssertionException
Asserts that the given Object argument is null.

Parameters:
o - The argument to assert is null.
message - The assertion message.
Throws:
AssertionException - If the given Object argument is not null.

assertNotNull

public static void assertNotNull(Object o,
                                 Object... message)
                          throws AssertionException
Asserts that the given Object argument is not null.

Parameters:
o - The argument to assert is not null.
message - The assertion message.
Throws:
AssertionException - If the given Object argument is null.

assertEqual

public static void assertEqual(Object expected,
                               Object actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected Object argument is equal to the actual Object argument. Equality of two references is determined by both referring to null or being equal according to the semantics of the java.lang.Object equals method.
expected == null && actual == null || (expected != null && expected.equals(actual))
If either the expected or actual argument is of type Byte, Short, Character, or Integer, it is explicitly promoted to type Long. If either argument is of type Float, it is promoted to type Double. This is so that the boxed type will be equal if it has the same value, even though it is of a different type. For example, assertEqual(7, 7L) will autobox each argument to type Integer and Long respectively, an since new Integer(7).equals(new Long(7L)) will be false, the assertion would fail, therefore, the first argument is promoted to type Long first, so that the test for equality will succeed.

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected Object argument is not equal to the actual Object argument.

assertEqual

public static void assertEqual(Object[] expected,
                               Object[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected Object array argument is equal to the actual Object array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of java.util.Arrays equals(Object[], Object[]) method
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected Object array argument is not equal to the actual Object array argument.

assertEqual

public static void assertEqual(double[] expected,
                               double[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected double array argument is equal to the actual double array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(double[], double[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected double array argument is not equal to the actual double array argument.

assertEqual

public static void assertEqual(float[] expected,
                               float[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected float array argument is equal to the actual float array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(float[], float[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected float array argument is not equal to the actual float array argument.

assertEqual

public static void assertEqual(boolean[] expected,
                               boolean[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected boolean array argument is equal to the actual boolean array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(boolean[], boolean[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected boolean array argument is not equal to the actual boolean array argument.

assertEqual

public static void assertEqual(byte[] expected,
                               byte[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected byte array argument is equal to the actual byte array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(byte[], byte[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected byte array argument is not equal to the actual byte array argument.

assertEqual

public static void assertEqual(short[] expected,
                               short[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected short array argument is equal to the actual short array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(short[], short[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected short array argument is not equal to the actual short array argument.

assertEqual

public static void assertEqual(char[] expected,
                               char[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected char array argument is equal to the actual char array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(char[], char[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected char array argument is not equal to the actual char array argument.

assertEqual

public static void assertEqual(int[] expected,
                               int[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected int array argument is equal to the actual int array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(int[], int[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected int array argument is not equal to the actual int array argument.

assertEqual

public static void assertEqual(long[] expected,
                               long[] actual,
                               Object... message)
                        throws AssertionException
Asserts that the given expected long array argument is equal to the actual long array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(long[], long[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected long array argument is not equal to the actual long array argument.

assertNotEqual

public static void assertNotEqual(Object expected,
                                  Object actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected Object argument is not equal to the actual Object argument. Equality of two references is determined by both referring to null or being equal according to the semantics of the java.lang.Object equals method.
!(expected == null && actual == null || (expected != null && expected.equals(actual))) If either the expected or actual argument is of type Byte, Short, Character, or Integer, it is explicitly promoted to type Long. If either argument is of type Float, it is promoted to type Double. This is so that the boxed type will be equal if it has the same value, even though it is of a different type. For example, assertEqual(7, 7L) will autobox each argument to type Integer and Long respectively, an since new Integer(7).equals(new Long(7L)) will be false, the assertion would fail, therefore, the first argument is promoted to type Long first, so that the test for equality will succeed.

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected Object argument is equal to the actual Object argument.

assertNotEqual

public static void assertNotEqual(Object[] expected,
                                  Object[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected Object array argument is not equal to the actual Object array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(Object[], Object[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected Object array argument is equal to the actual Object array argument.

assertNotEqual

public static void assertNotEqual(double[] expected,
                                  double[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected double array argument is not equal to the actual double array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(double[], double[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected double array argument is equal to the actual double array argument.

assertNotEqual

public static void assertNotEqual(float[] expected,
                                  float[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected float array argument is not equal to the actual float array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(float[], float[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected float array argument is equal to the actual float array argument.

assertNotEqual

public static void assertNotEqual(boolean[] expected,
                                  boolean[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected boolean array argument is not equal to the actual boolean array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(boolean[], boolean[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected boolean array argument is equal to the actual boolean array argument.

assertNotEqual

public static void assertNotEqual(byte[] expected,
                                  byte[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected byte array argument is not equal to the actual byte array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(byte[], byte[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected byte array argument is equal to the actual byte array argument.

assertNotEqual

public static void assertNotEqual(short[] expected,
                                  short[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected short array argument is not equal to the actual short array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(short[], short[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected short array argument is equal to the actual short array argument.

assertNotEqual

public static void assertNotEqual(char[] expected,
                                  char[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected char array argument is not equal to the actual char array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(char[], char[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected char array argument is equal to the actual char array argument.

assertNotEqual

public static void assertNotEqual(int[] expected,
                                  int[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected int array argument is not equal to the actual int array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(int[], int[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected int array argument is equal to the actual int array argument.

assertNotEqual

public static void assertNotEqual(long[] expected,
                                  long[] actual,
                                  Object... message)
                           throws AssertionException
Asserts that the given expected long array argument is not equal to the actual long array argument. Equality of two arrays references is determined by both referring to null or being equal according to the semantics of the java.util.Arrays equals(long[], long[]) method.
expected == null && actual == null || (Arrays.equals(expected, actual))

Parameters:
expected - The expected value to test for inequality.
actual - The actual value to test for inequality.
message - The assertion message.
Throws:
AssertionException - If the given expected long array argument is equal to the actual long array argument.

assertSame

public static void assertSame(Object expected,
                              Object actual,
                              Object... message)
                       throws AssertionException
Asserts that the given expected Object argument is referring to the same object as the actual Object argument.
expected == actual

Parameters:
expected - The expected value to test for sameness.
actual - The actual value to test for sameness.
message - The assertion message.
Throws:
AssertionException - If the given expected Object argument is not referring to the same object as the actual Object argument.

assertNotSame

public static void assertNotSame(Object expected,
                                 Object actual,
                                 Object... message)
                          throws AssertionException
Asserts that the given expected Object argument is not referring to the same object as the actual Object argument.
expected != actual

Parameters:
expected - The expected value to test for equality.
actual - The actual value to test for equality.
message - The assertion message.
Throws:
AssertionException - If the given expected Object argument is referring to the same object as the actual Object argument.