public abstract class AssertionErrors extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(String message,
Object expected,
Object actual)
Assert two objects are equal raise an
AssertionError if not. |
static void |
assertTrue(String message,
boolean condition)
Assert the given condition is
true and raise an
AssertionError if it is not. |
static void |
fail(String message)
Fails a test with the given message.
|
static void |
fail(String message,
Object expected,
Object actual)
Fails a test with the given message passing along expected and actual
values to be added to the message.
|
public static void fail(String message)
message
- describes the reason for the failurepublic static void fail(String message, Object expected, Object actual)
For example given:
assertEquals("Response header [" + name + "]", actual, expected);
The resulting message is:
Response header [Accept] expected:<application/json> but was:<text/plain>
message
- describes the value that failed the matchexpected
- expected valueactual
- actual valuepublic static void assertTrue(String message, boolean condition)
true
and raise an
AssertionError
if it is not.message
- the messagecondition
- the condition to test forpublic static void assertEquals(String message, Object expected, Object actual)
AssertionError
if not.
For example:
assertEquals("Response header [" + name + "]", actual, expected);
message
- describes the value being checkedexpected
- the expected valueactual
- the actual value