Important Note
Assertion methods comparing two values for equality, such as assertEquals, are only intended to test equality for an actual and an (un-)expected
result value. They are not designed for testing whether a class correctly implements equals(Object). For example assertEquals might return fast when provided with the same
object as actual and expected value without calling equals(Object) at all. Such tests
trying to verify the equals(Object) implementation should instead be written explicitly
and assertTrue or assertFalse should
be used to verify the result, e.g.: assertTrue(var.equals(var)), assertFalse(var.equals(null)).
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Assert.
This interface facilitates the use of |
| Modifier and Type | Field and Description |
|---|---|
| public static final String |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static void | |
| private static void | |
| public static void | assertEquals(Object
the actual value actual, Object the expected value expected, String the assertion error message message)Asserts that two objects are equal. |
| public static void | assertEquals(byte[]
the actual value actual, byte[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(byte[]
the actual value actual, byte[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(short[]
the actual value actual, short[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(short[]
the actual value actual, short[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(int[]
the actual value actual, int[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(int[]
the actual value actual, int[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(boolean[]
the actual value actual, boolean[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(boolean[]
the actual value actual, boolean[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(char[]
the actual value actual, char[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(char[]
the actual value actual, char[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(float[]
the actual value actual, float[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(float[]
the actual value actual, float[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(float[]
the actual value actual, float[] the expected value expected, float the absolute tolerable difference between the actual and expected values delta)Asserts that two arrays contain the equal elements concerning a delta in the same order. |
| public static void | assertEquals(float[]
the actual value actual, float[] the expected value expected, float the absolute tolerable difference between the actual and expected values delta, String the assertion error message message)Asserts that two arrays contain the equal elements concerning a delta in the same order. |
| public static void | assertEquals(double[]
the actual value actual, double[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(double[]
the actual value actual, double[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(double[]
the actual value actual, double[] the expected value expected, double the absolute tolerable difference between the actual and expected values delta)Asserts that two arrays contain the equal elements concerning a delta in the same order. |
| public static void | assertEquals(double[]
the actual value actual, double[] the expected value expected, double the absolute tolerable difference between the actual and expected values delta, String the assertion error message message)Asserts that two arrays contain the equal elements concerning a delta in the same order. |
| public static void | assertEquals(long[]
the actual value actual, long[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(long[]
the actual value actual, long[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(Object
the actual value actual, Object the expected value expected)Asserts that two objects are equal. |
| public static void | assertEquals(String
the actual value actual, String the expected value expected, String the assertion error message message)Asserts that two Strings are equal. |
| public static void | assertEquals(String
the actual value actual, String the expected value expected)Asserts that two Strings are equal. |
| public static void | assertEquals(double
the actual value actual, double the expected value expected, double the absolute tolerable difference between the actual and expected values delta, String the assertion error message message)Asserts that two doubles are equal concerning a delta. |
| public static void | assertEquals(double
the actual value actual, double the expected value expected, double the absolute tolerable difference between the actual and expected values delta)Asserts that two doubles are equal concerning a delta. |
| public static void | assertEquals(double
the actual value actual, double the expected value expected, String the assertion error message message)Asserts that two doubles are equal. |
| public static void | assertEquals(Double
the actual value actual, double the expected value expected, String the assertion error message message)Asserts that two doubles are equal. |
| public static void | assertEquals(double
the actual value actual, Double the expected value expected, String the assertion error message message)Asserts that two doubles are equal. |
| public static void | assertEquals(Double
the actual value actual, Double the expected value expected, String the assertion error message message)Asserts that two doubles are equal. |
| public static void | assertEquals(double
the actual value actual, double the expected value expected)Asserts that two doubles are equal. |
| public static void | assertEquals(Double
the actual value actual, double the expected value expected)Asserts that two doubles are equal. |
| public static void | assertEquals(double
the actual value actual, Double the expected value expected)Asserts that two doubles are equal. |
| public static void | assertEquals(Double
the actual value actual, Double the expected value expected)Asserts that two doubles are equal. |
| public static void | assertEquals(float
the actual value actual, float the expected value expected, float the absolute tolerable difference between the actual and expected values delta, String the assertion error message message)Asserts that two floats are equal concerning a delta. |
| public static void | assertEquals(float
the actual value actual, float the expected value expected, float the absolute tolerable difference between the actual and expected values delta)Asserts that two floats are equal concerning a delta. |
| public static void | assertEquals(float
the actual value actual, float the expected value expected, String the assertion error message message)Asserts that two floats are equal. |
| public static void | assertEquals(Float
the actual value actual, float the expected value expected, String the assertion error message message)Asserts that two floats are equal. |
| public static void | assertEquals(float
the actual value actual, Float the expected value expected, String the assertion error message message)Asserts that two floats are equal. |
| public static void | assertEquals(Float
the actual value actual, Float the expected value expected, String the assertion error message message)Asserts that two floats are equal. |
| public static void | assertEquals(float
the actual value actual, float the expected value expected)Asserts that two floats are equal. |
| public static void | assertEquals(Float
the actual value actual, float the expected value expected)Asserts that two floats are equal. |
| public static void | assertEquals(float
the actual value actual, Float the expected value expected)Asserts that two floats are equal. |
| public static void | assertEquals(Float
the actual value actual, Float the expected value expected)Asserts that two floats are equal. |
| public static void | assertEquals(long
the actual value actual, long the expected value expected, String the assertion error message message)Asserts that two longs are equal. |
| public static void | assertEquals(Long
the actual value actual, long the expected value expected, String the assertion error message message)Asserts that two longs are equal. |
| public static void | assertEquals(Long
the actual value actual, Long the expected value expected, String the assertion error message message)Asserts that two longs are equal. |
| public static void | assertEquals(long
the actual value actual, long the expected value expected)Asserts that two longs are equal. |
| public static void | assertEquals(Long
the actual value actual, long the expected value expected)Asserts that two longs are equal. |
| public static void | assertEquals(long
the actual value actual, Long the expected value expected)Asserts that two longs are equal. |
| public static void | assertEquals(Long
the actual value actual, Long the expected value expected)Asserts that two longs are equal. |
| public static void | assertEquals(boolean
the actual value actual, boolean the expected value expected, String the assertion error message message)Asserts that two booleans are equal. |
| public static void | assertEquals(Boolean
the actual value actual, boolean the expected value expected, String the assertion error message message)Asserts that two booleans are equal. |
| public static void | assertEquals(boolean
the actual value actual, Boolean the expected value expected, String the assertion error message message)Asserts that two booleans are equal. |
| public static void | assertEquals(Boolean
the actual value actual, Boolean the expected value expected, String the assertion error message message)Asserts that two booleans are equal. |
| public static void | assertEquals(boolean
the actual value actual, boolean the expected value expected)Asserts that two booleans are equal. |
| public static void | assertEquals(Boolean
the actual value actual, boolean the expected value expected)Asserts that two booleans are equal. |
| public static void | assertEquals(Boolean
the actual value actual, Boolean the expected value expected)Asserts that two booleans are equal. |
| public static void | assertEquals(boolean
the actual value actual, Boolean the expected value expected)Asserts that two booleans are equal. |
| public static void | assertEquals(byte
the actual value actual, byte the expected value expected, String the assertion error message message)Asserts that two bytes are equal. |
| public static void | assertEquals(Byte
the actual value actual, byte the expected value expected, String the assertion error message message)Asserts that two bytes are equal. |
| public static void | assertEquals(byte
the actual value actual, Byte the expected value expected, String the assertion error message message)Asserts that two bytes are equal. |
| public static void | assertEquals(Byte
the actual value actual, Byte the expected value expected, String the assertion error message message)Asserts that two bytes are equal. |
| public static void | assertEquals(byte
the actual value actual, byte the expected value expected)Asserts that two bytes are equal. |
| public static void | assertEquals(Byte
the actual value actual, byte the expected value expected)Asserts that two bytes are equal. |
| public static void | assertEquals(Byte
the actual value actual, Byte the expected value expected)Asserts that two bytes are equal. |
| public static void | assertEquals(byte
the actual value actual, Byte the expected value expected)Asserts that two bytes are equal. |
| public static void | assertEquals(char
the actual value actual, char the expected value expected, String the assertion error message message)Asserts that two chars are equal. |
| public static void | assertEquals(Character
the actual value actual, char the expected value expected, String the assertion error message message)Asserts that two chars are equal. |
| public static void | assertEquals(char
the actual value actual, Character the expected value expected, String the assertion error message message)Asserts that two chars are equal. |
| public static void | assertEquals(Character
the actual value actual, Character the expected value expected, String the assertion error message message)Asserts that two chars are equal. |
| public static void | assertEquals(char
the actual value actual, char the expected value expected)Asserts that two chars are equal. |
| public static void | assertEquals(Character
the actual value actual, char the expected value expected)Asserts that two chars are equal. |
| public static void | assertEquals(char
the actual value actual, Character the expected value expected)Asserts that two chars are equal. |
| public static void | assertEquals(Character
the actual value actual, Character the expected value expected)Asserts that two chars are equal. |
| public static void | assertEquals(short
the actual value actual, short the expected value expected, String the assertion error message message)Asserts that two shorts are equal. |
| public static void | assertEquals(Short
the actual value actual, short the expected value expected, String the assertion error message message)Asserts that two shorts are equal. |
| public static void | assertEquals(short
the actual value actual, Short the expected value expected, String the assertion error message message)Asserts that two shorts are equal. |
| public static void | assertEquals(Short
the actual value actual, Short the expected value expected, String the assertion error message message)Asserts that two shorts are equal. |
| public static void | assertEquals(short
the actual value actual, short the expected value expected)Asserts that two shorts are equal. |
| public static void | assertEquals(Short
the actual value actual, short the expected value expected)Asserts that two shorts are equal. |
| public static void | assertEquals(short
the actual value actual, Short the expected value expected)Asserts that two shorts are equal. |
| public static void | assertEquals(Short
the actual value actual, Short the expected value expected)Asserts that two shorts are equal. |
| public static void | assertEquals(int
the actual value actual, int the expected value expected, String the assertion error message message)Asserts that two ints are equal. |
| public static void | assertEquals(Integer
the actual value actual, int the expected value expected, String the assertion error message message)Asserts that two ints are equal. |
| public static void | assertEquals(int
the actual value actual, Integer the expected value expected, String the assertion error message message)Asserts that two ints are equal. |
| public static void | assertEquals(Integer
the actual value actual, Integer the expected value expected, String the assertion error message message)Asserts that two ints are equal. |
| public static void | assertEquals(int
the actual value actual, int the expected value expected)Asserts that two ints are equal. |
| public static void | assertEquals(Integer
the actual value actual, int the expected value expected)Asserts that two ints are equal. |
| public static void | assertEquals(int
the actual value actual, Integer the expected value expected)Asserts that two ints are equal. |
| public static void | assertEquals(Integer
the actual value actual, Integer the expected value expected)Asserts that two ints are equal. |
| public static void | assertEquals(Collection<?>
the actual value actual, Collection<?> the expected value expected)Asserts that two collections contain the same elements in the same order. |
| public static void | assertEquals(Collection<?>
the actual value actual, Collection<?> the expected value expected, String the assertion error message message)Asserts that two collections contain the same elements in the same order. |
| public static void | assertEquals(Iterator<?>
the actual value actual, Iterator<?> the expected value expected)Asserts that two iterators return the same elements in the same order. |
| public static void | assertEquals(Iterator<?>
the actual value actual, Iterator<?> the expected value expected, String the assertion error message message)Asserts that two iterators return the same elements in the same order. |
| public static void | assertEquals(Iterable<?>
the actual value actual, Iterable<?> the expected value expected)Asserts that two iterables return iterators with the same elements in the same order. |
| public static void | assertEquals(Iterable<?>
the actual value actual, Iterable<?> the expected value expected, String the assertion error message message)Asserts that two iterables return iterators with the same elements in the same order. |
| public static void | assertEquals(Object[]
the actual value actual, Object[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(Object[]
the actual value actual, Object[] the expected value expected)Asserts that two arrays contain the same elements in the same order. |
| public static void | assertEquals(Set<?>
The actual value actual, Set<?> The expected value expected)Asserts that two sets are equal. |
| public static void | assertEquals(Set<?>
The actual value actual, Set<?> The expected value expected, String The message message)Assert set equals |
| public static void | |
| public static void | assertEquals(Map<?, ?>
The actual value actual, Map<?, ?> The expected value expected, String The message message)Asserts that two maps are equal. |
| public static void | |
| public static void | |
| public static void | |
| private static void | assertEqualsImpl(Object actual, Object expected, String message)
Differs from |
| public static void | assertEqualsNoOrder(Object[]
the actual value actual, Object[] the expected value expected, String the assertion error message message)Asserts that two arrays contain the same elements in no particular order. |
| public static void | assertEqualsNoOrder(Collection<?>
the actual value actual, Collection<?> the expected value expected, String the assertion error message message)Asserts that two collection contain the same elements in no particular order. |
| public static void | assertEqualsNoOrder(Iterator<?>
the actual value actual, Iterator<?> the expected value expected, String the assertion error message message)Asserts that two iterators contain the same elements in no particular order. |
| public static void | assertEqualsNoOrder(Object[]
the actual value actual, Object[] the expected value expected)Asserts that two arrays contain the same elements in no particular order. |
| public static void | assertEqualsNoOrder(Collection<?>
the actual value actual, Collection<?> the expected value expected)Asserts that two collection contain the same elements in no particular order. |
| public static void | assertEqualsNoOrder(Iterator<?>
the actual value actual, Iterator<?> the expected value expected)Asserts that two iterators contain the same elements in no particular order. |
| public static void | assertFalse(boolean
the condition to evaluate condition, String the assertion error message message)Asserts that a condition is false. |
| public static void | |
| public static < type of object T> void | assertListContains(List<T>
the list to search in list, Predicate<T> the Predicate to match object predicate, String the fail message message)Asserts that List contains object by specific Predicate. |
| public static < type of object T> void | assertListContainsObject(List<T>
the list to search in list, T the object to search in list object, String the fail message message)Asserts that List contains object. |
| public static < type of object T> void | assertListNotContains(List<T>
the list to search in list, Predicate<T> the Predicate to match object predicate, String the fail message message)Asserts that List not contains object by specific Predicate. |
| public static < type of object T> void | assertListNotContainsObject(List<T>
the list to search in list, T to search in list object, String the fail message message)Asserts that List not contains object. |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| private static void | |
| public static void | |
| public static void | assertNotNull(Object
the assertion object object, String the assertion error message message)Asserts that an object isn't null. |
| public static void | assertNotSame(Object
the actual value actual, Object the expected value expected, String the assertion error message message)Asserts that two objects do not refer to the same objects. |
| public static void | assertNotSame(Object
the actual value actual, Object the expected value expected)Asserts that two objects do not refer to the same object. |
| public static void | |
| public static void | assertNull(Object
the assertion object object, String the assertion error message message)Asserts that an object is null. |
| public static void | assertSame(Object
the actual value actual, Object the expected value expected, String the assertion error message message)Asserts that two objects refer to the same object. |
| public static void | assertSame(Object
the actual value actual, Object the expected value expected)Asserts that two objects refer to the same object. |
| public static void | assertThrows(Assert.
A function that is expected to throw an exception when invoked runnableAsserts that |
| public static < the expected type of the exception T extends Throwable> void | assertThrows(Class<T>
the expected type of the exception throwableClass, Assert.A function that is expected to throw an exception when invoked runnableAsserts that |
| public static < the expected type of the exception T extends Throwable> void | assertThrows(String
fail message message, Class<T> the expected type of the exception throwableClass, Assert.A function that is expected to throw an exception when invoked runnableAsserts that |
| public static void | assertTrue(boolean
the condition to evaluate condition, String the assertion error message message)Asserts that a condition is true. |
| public static void | |
| private static boolean | Returns: true if actualArray and expectedArray are the same, false otherwise. If references are different and arrays length are different AssertionError is thrown.array of elements actualArray, Object array of elements expectedArray, String the assertion error message message)This methods check referential equality of given arguments as well as references length (assuming they are arrays). |
| public static < the expected type of the exception T extends Throwable> T | Returns: The exception thrown byrunnablethe expected type of the exception throwableClass, Assert.A function that is expected to throw an exception when invoked runnableAsserts that |
| public static < the expected type of the exception T extends Throwable> T | Returns: The exception thrown byrunnablefail message message, Class<T> the expected type of the exception throwableClass, Assert.A function that is expected to throw an exception when invoked runnableAsserts that |
| public static void | |
| public static void | |
| public static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| pack-priv static String | |
| private static String | |
| private static String | |
| private static String | getNotEqualDeepReason(Map<?, ?> actual, Map<?, ?> expected)
returns not equal deep reason or null if equal |
| private static String | getNotEqualReason(Collection<?> actual, Collection<?> expected)
returns not equal reason or null if equal |
| private static String | |
| private static String | |
| private static String | |
| private static String |