|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object momeunit.framework.Assert
public class Assert
A collection of static assert methods. A TestCase base class. If assertion
fails AssertionFailedError
with descriptive message is thrown.
Note In this package there is no
ComparisonFailure
class. The processing of compared strings
contained in this class is optimized and moved to the respective assert
methods.
Constructor Summary | |
---|---|
protected |
Assert()
Protect constructor since it is a static only class |
Method Summary | |
---|---|
static void |
assertEquals(boolean expected,
boolean actual)
Asserts that two booleans are equal. |
static void |
assertEquals(byte expected,
byte actual)
Asserts that two bytes are equal. |
static void |
assertEquals(char expected,
char actual)
Asserts that two chars are equal. |
static void |
assertEquals(double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
static void |
assertEquals(float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
static void |
assertEquals(int expected,
int actual)
Asserts that two ints are equal. |
static void |
assertEquals(long expected,
long actual)
Asserts that two longs are equal. |
static void |
assertEquals(Object expected,
Object actual)
Asserts that two objects are equal. |
static void |
assertEquals(short expected,
short actual)
Asserts that two shorts are equal. |
static void |
assertEquals(String message,
boolean expected,
boolean actual)
Asserts that two booleans are equal. |
static void |
assertEquals(String message,
byte expected,
byte actual)
Asserts that two bytes are equal. |
static void |
assertEquals(String message,
char expected,
char actual)
Asserts that two chars are equal. |
static void |
assertEquals(String message,
double expected,
double actual,
double delta)
Asserts that two doubles are equal concerning a delta. |
static void |
assertEquals(String message,
float expected,
float actual,
float delta)
Asserts that two floats are equal concerning a delta. |
static void |
assertEquals(String message,
int expected,
int actual)
Asserts that two ints are equal. |
static void |
assertEquals(String message,
long expected,
long actual)
Asserts that two longs are equal. |
static void |
assertEquals(String message,
Object expected,
Object actual)
Asserts that two objects are equal. |
static void |
assertEquals(String message,
short expected,
short actual)
Asserts that two shorts are equal. |
static void |
assertEquals(String expected,
String actual)
Asserts that two Strings are equal. |
static void |
assertEquals(String message,
String expected,
String actual)
Asserts that two Strings are equal. |
static void |
assertFalse(boolean condition)
Asserts that a given condition is false. |
static void |
assertFalse(String message,
boolean condition)
Asserts that a given condition is false. |
static void |
assertNotNull(Object object)
Asserts that an object isn't null. |
static void |
assertNotNull(String message,
Object object)
Asserts that an object isn't null. |
static void |
assertNotSame(Object expected,
Object actual)
Asserts that two objects don't refer to the same object. |
static void |
assertNotSame(String message,
Object expected,
Object actual)
Asserts that two objects don't refer to the same object. |
static void |
assertNull(Object object)
Asserts that an object is null. |
static void |
assertNull(String message,
Object object)
Asserts that an object is null. |
static void |
assertSame(Object expected,
Object actual)
Asserts that two objects refer to the same object. |
static void |
assertSame(String message,
Object expected,
Object actual)
Asserts that two objects refer to the same object. |
static void |
assertTrue(boolean condition)
Asserts that a given condition is true. |
static void |
assertTrue(String message,
boolean condition)
Asserts that a given condition is true. |
static void |
fail()
Fails a test with no message. |
static void |
fail(String message)
Fails a test with a given message. |
(package private) static String |
format(String message,
Object expected,
Object actual)
Returns the formatted message based on specified message and compared objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Assert()
Method Detail |
---|
public static void assertTrue(String message, boolean condition)
message
- descriptive message of failure.condition
- condition to check.public static void assertTrue(boolean condition)
condition
- condition to check.public static void assertFalse(String message, boolean condition)
message
- descriptive message of failure.condition
- condition to check.public static void assertFalse(boolean condition)
condition
- condition to check.public static void fail(String message)
message
- descriptive message of failure.public static void fail()
public static void assertEquals(String message, Object expected, Object actual)
message
- descriptive message of failure.expected
- expected object to be tested.actual
- actual object to be tested.public static void assertEquals(Object expected, Object actual)
expected
- expected object to be tested.actual
- actual object to be tested.public static void assertEquals(String message, String expected, String actual)
message
- descriptive message of failure.expected
- expected String to be tested.actual
- actual String to be tested.public static void assertEquals(String expected, String actual)
expected
- expected String to be tested.actual
- actual String to be tested.public static void assertEquals(String message, double expected, double actual, double delta)
message
- descriptive message of failure.expected
- expected double to be tested.actual
- actual double to be tested.delta
- precision of comparison.public static void assertEquals(double expected, double actual, double delta)
expected
- expected double to be tested.actual
- actual double to be tested.delta
- precision of comparison.public static void assertEquals(String message, float expected, float actual, float delta)
message
- descriptive message of failure.expected
- expected float to be tested.actual
- actual float to be tested.delta
- precision of comparison.public static void assertEquals(float expected, float actual, float delta)
expected
- float to be tested.actual
- float to be tested.delta
- precision of comparison.public static void assertEquals(String message, long expected, long actual)
message
- descriptive message of failure.expected
- long to be tested.actual
- long to be tested.public static void assertEquals(long expected, long actual)
expected
- long to be tested.actual
- long to be tested.public static void assertEquals(String message, boolean expected, boolean actual)
message
- descriptive message of failure.expected
- boolean to be tested.actual
- boolean to be tested.public static void assertEquals(boolean expected, boolean actual)
expected
- boolean to be tested.actual
- boolean to be tested.public static void assertEquals(String message, byte expected, byte actual)
message
- descriptive message of failure.expected
- byte to be tested.actual
- byte to be tested.public static void assertEquals(byte expected, byte actual)
expected
- byte to be tested.actual
- byte to be tested.public static void assertEquals(String message, char expected, char actual)
message
- descriptive message of failure.expected
- char to be tested.actual
- char to be tested.public static void assertEquals(char expected, char actual)
expected
- char to be tested.actual
- char to be tested.public static void assertEquals(String message, short expected, short actual)
message
- descriptive message of failure.expected
- short to be tested.actual
- short to be tested.public static void assertEquals(short expected, short actual)
expected
- short to be tested.actual
- short to be tested.public static void assertEquals(String message, int expected, int actual)
message
- descriptive message of failure.expected
- int to be tested.actual
- int to be tested.public static void assertEquals(int expected, int actual)
expected
- int to be tested.actual
- int to be tested.public static void assertNotNull(Object object)
object
- to test.public static void assertNotNull(String message, Object object)
message
- descriptive message of failure.object
- to test.public static void assertNull(Object object)
object
- to test.public static void assertNull(String message, Object object)
message
- descriptive message of failure.object
- to test.public static void assertSame(String message, Object expected, Object actual)
message
- descriptive message of failure.expected
- object to test.actual
- object to test.public static void assertSame(Object expected, Object actual)
expected
- object to test.actual
- object to test.public static void assertNotSame(String message, Object expected, Object actual)
message
- descriptive message of failure.expected
- object to test.actual
- object to test.public static void assertNotSame(Object expected, Object actual)
expected
- object to test.actual
- object to test.static String format(String message, Object expected, Object actual)
message
- descriotive message.expected
- expected tested object.actual
- actual tested object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |