public abstract class AssertionErrors
extends java.lang.Object
Constructor and Description |
---|
AssertionErrors() |
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Assert two objects are equal and raise an
AssertionError if not. |
static void |
assertNotEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Assert two objects are not equal and raise an
AssertionError otherwise. |
static void |
assertTrue(java.lang.String message,
boolean condition)
Assert the given condition is
true and raise an
AssertionError if it is not. |
static void |
fail(java.lang.String message)
Fails a test with the given message.
|
static void |
fail(java.lang.String message,
java.lang.Object expected,
java.lang.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(java.lang.String message)
message
- describes the reason for the failurepublic static void fail(java.lang.String message, @Nullable java.lang.Object expected, @Nullable java.lang.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(java.lang.String message, boolean condition)
true
and raise an
AssertionError
if it is not.message
- the messagecondition
- the condition to test forpublic static void assertEquals(java.lang.String message, @Nullable java.lang.Object expected, @Nullable java.lang.Object actual)
AssertionError
if not.
For example:
assertEquals("Response header [" + name + "]", expected, actual);
message
- describes the value being checkedexpected
- the expected valueactual
- the actual valuepublic static void assertNotEquals(java.lang.String message, @Nullable java.lang.Object expected, @Nullable java.lang.Object actual)
AssertionError
otherwise.
For example:
assertNotEquals("Response header [" + name + "]", expected, actual);
message
- describes the value being checkedexpected
- the expected valueactual
- the actual value