All the assertions are in the Assert class.
public class Assert extends java.lang.Object
This class provides a set of assertion methods, useful for writing tests. Only failed assertions are recorded. Some of the important methods of Assert class are as follows −
||Methods & Description|
void assertEquals(boolean expected, boolean actual)
Checks that two primitives/objects are equal.
void assertTrue(boolean condition)
Checks that a condition is true.
void assertFalse(boolean condition)
Checks that a condition is false.
void assertNotNull(Object object)
Checks that an object isn't null.
void assertNull(Object object)
Checks that an object is null.
void assertSame(object1, object2)
The assertSame() method tests if two object references point to the same object.
void assertNotSame(object1, object2)
The assertNotSame() method tests if two object references do not point to the same object.
void assertArrayEquals(expectedArray, resultArray);
The assertArrayEquals() method will test whether two arrays are equal to each other.