|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jtiger.assertion.Basic
public final class Basic
Provides the ability to make assertions that are of the most basic and trivial concepts.
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 |
---|
public static void assertTrue(boolean b, Object... message) throws AssertionException
boolean
argument is true
.
b
- The argument to assert is true
.message
- The assertion message.
AssertionException
- If the given boolean
argument is not true
.public static void assertFalse(boolean b, Object... message) throws AssertionException
boolean
argument is true
.
b
- The argument to assert is true
.message
- The assertion message.
AssertionException
- If the given boolean
argument is not true
.public static void assertNull(Object o, Object... message) throws AssertionException
Object
argument is null
.
o
- The argument to assert is null
.message
- The assertion message.
AssertionException
- If the given Object
argument is not null
.public static void assertNotNull(Object o, Object... message) throws AssertionException
Object
argument is not null
.
o
- The argument to assert is not null
.message
- The assertion message.
AssertionException
- If the given Object
argument is null
.public static void assertEqual(Object expected, Object actual, Object... message) throws AssertionException
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))
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.
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected Object
argument is not equal to the actual
Object
argument.public static void assertEqual(Object[] expected, Object[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected Object
array argument is not equal to the actual
Object
array argument.public static void assertEqual(double[] expected, double[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected double
array argument is not equal to the actual
double
array argument.public static void assertEqual(float[] expected, float[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected float
array argument is not equal to the actual
float
array argument.public static void assertEqual(boolean[] expected, boolean[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected boolean
array argument is not equal to the actual
boolean
array argument.public static void assertEqual(byte[] expected, byte[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected byte
array argument is not equal to the actual
byte
array argument.public static void assertEqual(short[] expected, short[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected short
array argument is not equal to the actual
short
array argument.public static void assertEqual(char[] expected, char[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected char
array argument is not equal to the actual
char
array argument.public static void assertEqual(int[] expected, int[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected int
array argument is not equal to the actual
int
array argument.public static void assertEqual(long[] expected, long[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected long
array argument is not equal to the actual
long
array argument.public static void assertNotEqual(Object expected, Object actual, Object... message) throws AssertionException
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.
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected Object
argument is equal to the actual
Object
argument.public static void assertNotEqual(Object[] expected, Object[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected Object
array argument is equal to the actual
Object
array argument.public static void assertNotEqual(double[] expected, double[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected double
array argument is equal to the actual
double
array argument.public static void assertNotEqual(float[] expected, float[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected float
array argument is equal to the actual
float
array argument.public static void assertNotEqual(boolean[] expected, boolean[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected boolean
array argument is equal to the actual
boolean
array argument.public static void assertNotEqual(byte[] expected, byte[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected byte
array argument is equal to the actual
byte
array argument.public static void assertNotEqual(short[] expected, short[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected short
array argument is equal to the actual
short
array argument.public static void assertNotEqual(char[] expected, char[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected char
array argument is equal to the actual
char
array argument.public static void assertNotEqual(int[] expected, int[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected int
array argument is equal to the actual
int
array argument.public static void assertNotEqual(long[] expected, long[] actual, Object... message) throws AssertionException
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))
expected
- The expected value to test for inequality.actual
- The actual value to test for inequality.message
- The assertion message.
AssertionException
- If the given expected long
array argument is equal to the actual
long
array argument.public static void assertSame(Object expected, Object actual, Object... message) throws AssertionException
Object
argument is referring to the same object as the actual
Object
argument.
expected == actual
expected
- The expected value to test for sameness.actual
- The actual value to test for sameness.message
- The assertion message.
AssertionException
- If the given expected Object
argument is not referring to the same object
as the actual Object
argument.public static void assertNotSame(Object expected, Object actual, Object... message) throws AssertionException
Object
argument is not referring to the same object as the actual
Object
argument.
expected != actual
expected
- The expected value to test for equality.actual
- The actual value to test for equality.message
- The assertion message.
AssertionException
- If the given expected Object
argument is referring to the same object as
the actual Object
argument.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |