- java.lang.Object
-
- org.junit.jupiter.api.Assertions
-
@API(status=STABLE, since="5.0") public class Assertions extends Object
Assertions
is a collection of utility methods that support asserting conditions in tests.Unless otherwise noted, a failed assertion will throw an
AssertionFailedError
or a subclass thereof.Kotlin Support
Additional Kotlin assertions can be found as top-level functions in the
org.junit.jupiter.api
package.Preemptive Timeouts
The various
assertTimeoutPreemptively()
methods in this class execute the providedexecutable
orsupplier
in a different thread than that of the calling code. This behavior can lead to undesirable side effects if the code that is executed within theexecutable
orsupplier
relies onThreadLocal
storage.One common example of this is the transactional testing support in the Spring Framework. Specifically, Spring's testing support binds transaction state to the current thread (via a
ThreadLocal
) before a test method is invoked. Consequently, if anexecutable
orsupplier
provided toassertTimeoutPreemptively()
invokes Spring-managed components that participate in transactions, any actions taken by those components will not be rolled back with the test-managed transaction. On the contrary, such actions will be committed to the persistent store (e.g., relational database) even though the test-managed transaction is rolled back.Similar side effects may be encountered with other frameworks that rely on
ThreadLocal
storage.Extensibility
Although it is technically possible to extend this class, extension is strongly discouraged. The JUnit Team highly recommends that the methods defined in this class be used via static imports.
- Since:
- 5.0
- See Also:
AssertionFailedError
,Assumptions
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Assertions()
Protected constructor allowing subclassing but not direct instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertAll(String heading, Collection<Executable> executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertAll(String heading, Stream<Executable> executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertAll(String heading, Executable... executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertAll(Collection<Executable> executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertAll(Stream<Executable> executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertAll(Executable... executables)
Assert that all suppliedexecutables
do not throw exceptions.static void
assertArrayEquals(boolean[] expected, boolean[] actual)
Assert thatexpected
andactual
boolean arrays are equal.static void
assertArrayEquals(boolean[] expected, boolean[] actual, String message)
Assert thatexpected
andactual
boolean arrays are equal.static void
assertArrayEquals(boolean[] expected, boolean[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
boolean arrays are equal.static void
assertArrayEquals(byte[] expected, byte[] actual)
Assert thatexpected
andactual
byte arrays are equal.static void
assertArrayEquals(byte[] expected, byte[] actual, String message)
Assert thatexpected
andactual
byte arrays are equal.static void
assertArrayEquals(byte[] expected, byte[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
byte arrays are equal.static void
assertArrayEquals(char[] expected, char[] actual)
Assert thatexpected
andactual
char arrays are equal.static void
assertArrayEquals(char[] expected, char[] actual, String message)
Assert thatexpected
andactual
char arrays are equal.static void
assertArrayEquals(char[] expected, char[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
char arrays are equal.static void
assertArrayEquals(double[] expected, double[] actual)
Assert thatexpected
andactual
double arrays are equal.static void
assertArrayEquals(double[] expected, double[] actual, double delta)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(double[] expected, double[] actual, double delta, String message)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(double[] expected, double[] actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(double[] expected, double[] actual, String message)
Assert thatexpected
andactual
double arrays are equal.static void
assertArrayEquals(double[] expected, double[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
double arrays are equal.static void
assertArrayEquals(float[] expected, float[] actual)
Assert thatexpected
andactual
float arrays are equal.static void
assertArrayEquals(float[] expected, float[] actual, float delta)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(float[] expected, float[] actual, float delta, String message)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(float[] expected, float[] actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.static void
assertArrayEquals(float[] expected, float[] actual, String message)
Assert thatexpected
andactual
float arrays are equal.static void
assertArrayEquals(float[] expected, float[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
float arrays are equal.static void
assertArrayEquals(int[] expected, int[] actual)
Assert thatexpected
andactual
int arrays are equal.static void
assertArrayEquals(int[] expected, int[] actual, String message)
Assert thatexpected
andactual
int arrays are equal.static void
assertArrayEquals(int[] expected, int[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
int arrays are equal.static void
assertArrayEquals(long[] expected, long[] actual)
Assert thatexpected
andactual
long arrays are equal.static void
assertArrayEquals(long[] expected, long[] actual, String message)
Assert thatexpected
andactual
long arrays are equal.static void
assertArrayEquals(long[] expected, long[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
long arrays are equal.static void
assertArrayEquals(short[] expected, short[] actual)
Assert thatexpected
andactual
short arrays are equal.static void
assertArrayEquals(short[] expected, short[] actual, String message)
Assert thatexpected
andactual
short arrays are equal.static void
assertArrayEquals(short[] expected, short[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
short arrays are equal.static void
assertArrayEquals(Object[] expected, Object[] actual)
Assert thatexpected
andactual
object arrays are deeply equal.static void
assertArrayEquals(Object[] expected, Object[] actual, String message)
Assert thatexpected
andactual
object arrays are deeply equal.static void
assertArrayEquals(Object[] expected, Object[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
object arrays are deeply equal.static void
assertDoesNotThrow(Executable executable)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.static void
assertDoesNotThrow(Executable executable, String message)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.static void
assertDoesNotThrow(Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.static <T> T
assertDoesNotThrow(ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.static <T> T
assertDoesNotThrow(ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.static <T> T
assertDoesNotThrow(ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.static void
assertEquals(byte expected, byte actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(byte expected, byte actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(byte expected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(byte expected, Byte actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(byte expected, Byte actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(byte expected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, char actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, char actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, Character actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, Character actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(char expected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, double actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, double actual, double delta)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(double expected, double actual, double delta, String message)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(double expected, double actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(double expected, double actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, Double actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, Double actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(double expected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, float actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, float actual, float delta)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(float expected, float actual, float delta, String message)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(float expected, float actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.static void
assertEquals(float expected, float actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, Float actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, Float actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(float expected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, int actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, int actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, Integer actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, Integer actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(int expected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, long actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, long actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, Long actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, Long actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(long expected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, short actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, short actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, Short actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, Short actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(short expected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, byte actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, byte actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, Byte actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, Byte actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Byte expected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, char actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, char actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, Character actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, Character actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Character expected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, double actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, double actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, Double actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, Double actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Double expected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, float actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, float actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, Float actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, Float actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Float expected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, int actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, int actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, Integer actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, Integer actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Integer expected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, long actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, long actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, Long actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, Long actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Long expected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Object expected, Object actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Object expected, Object actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Object expected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, short actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, short actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, Short actual)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, Short actual, String message)
Assert thatexpected
andactual
are equal.static void
assertEquals(Short expected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.static void
assertFalse(boolean condition)
Assert that the suppliedcondition
isfalse
.static void
assertFalse(boolean condition, String message)
Assert that the suppliedcondition
isfalse
.static void
assertFalse(boolean condition, Supplier<String> messageSupplier)
Assert that the suppliedcondition
isfalse
.static void
assertFalse(BooleanSupplier booleanSupplier)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.static void
assertFalse(BooleanSupplier booleanSupplier, String message)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.static void
assertFalse(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.static void
assertIterableEquals(Iterable<?> expected, Iterable<?> actual)
Assert thatexpected
andactual
iterables are deeply equal.static void
assertIterableEquals(Iterable<?> expected, Iterable<?> actual, String message)
Assert thatexpected
andactual
iterables are deeply equal.static void
assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
iterables are deeply equal.static void
assertLinesMatch(List<String> expectedLines, List<String> actualLines)
static void
assertLinesMatch(List<String> expectedLines, List<String> actualLines, String message)
static void
assertLinesMatch(List<String> expectedLines, List<String> actualLines, Supplier<String> messageSupplier)
static void
assertNotEquals(byte unexpected, byte actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(byte unexpected, byte actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(byte unexpected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(byte unexpected, Byte actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(byte unexpected, Byte actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(byte unexpected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, char actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, char actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, Character actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, Character actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(char unexpected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, double actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, double actual, double delta)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(double unexpected, double actual, double delta, String message)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(double unexpected, double actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(double unexpected, double actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, Double actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, Double actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(double unexpected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, float actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, float actual, float delta)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(float unexpected, float actual, float delta, String message)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(float unexpected, float actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal within the givendelta
.static void
assertNotEquals(float unexpected, float actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, Float actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, Float actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(float unexpected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, int actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, int actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, Integer actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, Integer actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(int unexpected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, long actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, long actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, Long actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, Long actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(long unexpected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, short actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, short actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, Short actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, Short actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(short unexpected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, byte actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, byte actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, Byte actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, Byte actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Byte unexpected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, char actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, char actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, Character actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, Character actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Character unexpected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, double actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, double actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, Double actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, Double actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Double unexpected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, float actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, float actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, Float actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, Float actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Float unexpected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, int actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, int actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, Integer actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, Integer actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Integer unexpected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, long actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, long actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, Long actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, Long actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Long unexpected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Object unexpected, Object actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Object unexpected, Object actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Object unexpected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, short actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, short actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, Short actual)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, Short actual, String message)
Assert thatexpected
andactual
are not equal.static void
assertNotEquals(Short unexpected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.static void
assertNotNull(Object actual)
Assert thatactual
is notnull
.static void
assertNotNull(Object actual, String message)
Assert thatactual
is notnull
.static void
assertNotNull(Object actual, Supplier<String> messageSupplier)
Assert thatactual
is notnull
.static void
assertNotSame(Object unexpected, Object actual)
Assert thatexpected
andactual
do not refer to the same object.static void
assertNotSame(Object unexpected, Object actual, String message)
Assert thatexpected
andactual
do not refer to the same object.static void
assertNotSame(Object unexpected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
do not refer to the same object.static void
assertNull(Object actual)
Assert thatactual
isnull
.static void
assertNull(Object actual, String message)
Assert thatactual
isnull
.static void
assertNull(Object actual, Supplier<String> messageSupplier)
Assert thatactual
isnull
.static void
assertSame(Object expected, Object actual)
Assert thatexpected
andactual
refer to the same object.static void
assertSame(Object expected, Object actual, String message)
Assert thatexpected
andactual
refer to the same object.static void
assertSame(Object expected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
refer to the same object.static <T extends Throwable>
TassertThrows(Class<T> expectedType, Executable executable)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.static <T extends Throwable>
TassertThrows(Class<T> expectedType, Executable executable, String message)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.static <T extends Throwable>
TassertThrows(Class<T> expectedType, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.static void
assertTimeout(Duration timeout, Executable executable)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static void
assertTimeout(Duration timeout, Executable executable, String message)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static void
assertTimeout(Duration timeout, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static <T> T
assertTimeout(Duration timeout, ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static <T> T
assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static <T> T
assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static void
assertTimeoutPreemptively(Duration timeout, Executable executable)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static void
assertTimeoutPreemptively(Duration timeout, Executable executable, String message)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static void
assertTimeoutPreemptively(Duration timeout, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.static <T> T
assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static <T> T
assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static <T> T
assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.static void
assertTrue(boolean condition)
Assert that the suppliedcondition
istrue
.static void
assertTrue(boolean condition, String message)
Assert that the suppliedcondition
istrue
.static void
assertTrue(boolean condition, Supplier<String> messageSupplier)
Assert that the suppliedcondition
istrue
.static void
assertTrue(BooleanSupplier booleanSupplier)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.static void
assertTrue(BooleanSupplier booleanSupplier, String message)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.static void
assertTrue(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.static <V> V
fail()
Fail the test without a failure message.static <V> V
fail(String message)
Fail the test with the given failuremessage
.static <V> V
fail(String message, Throwable cause)
Fail the test with the given failuremessage
as well as the underlyingcause
.static <V> V
fail(Throwable cause)
Fail the test with the given underlyingcause
.static <V> V
fail(Supplier<String> messageSupplier)
Fail the test with the failure message retrieved from the givenmessageSupplier
.
-
-
-
Method Detail
-
fail
public static <V> V fail()
Fail the test without a failure message.Although failing with an explicit failure message is recommended, this method may be useful when maintaining legacy code.
See Javadoc for
fail(String, Throwable)
for an explanation of this method's generic return typeV
.
-
fail
public static <V> V fail(String message)
Fail the test with the given failuremessage
.See Javadoc for
fail(String, Throwable)
for an explanation of this method's generic return typeV
.
-
fail
public static <V> V fail(String message, Throwable cause)
Fail the test with the given failuremessage
as well as the underlyingcause
.The generic return type
V
allows this method to be used directly as a single-statement lambda expression, thereby avoiding the need to implement a code block with an explicit return value. Since this method throws anAssertionFailedError
before its return statement, this method never actually returns a value to its caller. The following example demonstrates how this may be used in practice.Stream.of().map(entry -> fail("should not be called"));
-
fail
public static <V> V fail(Throwable cause)
Fail the test with the given underlyingcause
.See Javadoc for
fail(String, Throwable)
for an explanation of this method's generic return typeV
.
-
fail
public static <V> V fail(Supplier<String> messageSupplier)
Fail the test with the failure message retrieved from the givenmessageSupplier
.See Javadoc for
fail(String, Throwable)
for an explanation of this method's generic return typeV
.
-
assertTrue
public static void assertTrue(boolean condition)
Assert that the suppliedcondition
istrue
.
-
assertTrue
public static void assertTrue(boolean condition, Supplier<String> messageSupplier)
Assert that the suppliedcondition
istrue
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertTrue
public static void assertTrue(BooleanSupplier booleanSupplier)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.
-
assertTrue
public static void assertTrue(BooleanSupplier booleanSupplier, String message)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.Fails with the supplied failure
message
.
-
assertTrue
public static void assertTrue(boolean condition, String message)
Assert that the suppliedcondition
istrue
.Fails with the supplied failure
message
.
-
assertTrue
public static void assertTrue(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier)
Assert that the boolean condition supplied bybooleanSupplier
istrue
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertFalse
public static void assertFalse(boolean condition)
Assert that the suppliedcondition
isfalse
.
-
assertFalse
public static void assertFalse(boolean condition, String message)
Assert that the suppliedcondition
isfalse
.Fails with the supplied failure
message
.
-
assertFalse
public static void assertFalse(boolean condition, Supplier<String> messageSupplier)
Assert that the suppliedcondition
isfalse
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertFalse
public static void assertFalse(BooleanSupplier booleanSupplier)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.
-
assertFalse
public static void assertFalse(BooleanSupplier booleanSupplier, String message)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.Fails with the supplied failure
message
.
-
assertFalse
public static void assertFalse(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier)
Assert that the boolean condition supplied bybooleanSupplier
isfalse
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertNull
public static void assertNull(Object actual)
Assert thatactual
isnull
.
-
assertNull
public static void assertNull(Object actual, String message)
Assert thatactual
isnull
.Fails with the supplied failure
message
.
-
assertNull
public static void assertNull(Object actual, Supplier<String> messageSupplier)
Assert thatactual
isnull
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertNotNull
public static void assertNotNull(Object actual)
Assert thatactual
is notnull
.
-
assertNotNull
public static void assertNotNull(Object actual, String message)
Assert thatactual
is notnull
.Fails with the supplied failure
message
.
-
assertNotNull
public static void assertNotNull(Object actual, Supplier<String> messageSupplier)
Assert thatactual
is notnull
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(short expected, short actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(short expected, Short actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(Short expected, short actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Short expected, Short actual)
Assert thatexpected
andactual
are equal.- Since:
- 5.4
-
assertEquals
public static void assertEquals(short expected, short actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(short expected, Short actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Short expected, short actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Short expected, Short actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(short expected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(short expected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Short expected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Short expected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(byte expected, byte actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(byte expected, Byte actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(Byte expected, byte actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Byte expected, Byte actual)
Assert thatexpected
andactual
are equal.- Since:
- 5.4
-
assertEquals
public static void assertEquals(byte expected, byte actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(byte expected, Byte actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Byte expected, byte actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Byte expected, Byte actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(byte expected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(byte expected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Byte expected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Byte expected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(int expected, int actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(int expected, Integer actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(Integer expected, int actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Integer expected, Integer actual)
Assert thatexpected
andactual
are equal.- Since:
- 5.4
-
assertEquals
public static void assertEquals(int expected, int actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(int expected, Integer actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Integer expected, int actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Integer expected, Integer actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(int expected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(int expected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Integer expected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Integer expected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(long expected, long actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(long expected, Long actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(Long expected, long actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Long expected, Long actual)
Assert thatexpected
andactual
are equal.- Since:
- 5.4
-
assertEquals
public static void assertEquals(long expected, long actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(long expected, Long actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Long expected, long actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Long expected, Long actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(long expected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(long expected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Long expected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Long expected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(float expected, float actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertEquals
public static void assertEquals(float expected, Float actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertEquals
public static void assertEquals(Float expected, float actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Float expected, Float actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(float expected, float actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(float expected, Float actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Float expected, float actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Float expected, Float actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(float expected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(float expected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Float expected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Float expected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(float expected, float actual, float delta)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertEquals
public static void assertEquals(float expected, float actual, float delta, String message)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(float expected, float actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(double expected, double actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertEquals
public static void assertEquals(double expected, Double actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertEquals
public static void assertEquals(Double expected, double actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Double expected, Double actual)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(double expected, double actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(double expected, Double actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Double expected, double actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Double expected, Double actual, String message)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(double expected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(double expected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Double expected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Double expected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(double expected, double actual, double delta)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertEquals
public static void assertEquals(double expected, double actual, double delta, String message)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(double expected, double actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(char expected, char actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(char expected, Character actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
public static void assertEquals(Character expected, char actual)
Assert thatexpected
andactual
are equal.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Character expected, Character actual)
Assert thatexpected
andactual
are equal.- Since:
- 5.4
-
assertEquals
public static void assertEquals(char expected, char actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(char expected, Character actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
public static void assertEquals(Character expected, char actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Character expected, Character actual, String message)
Assert thatexpected
andactual
are equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(char expected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(char expected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
public static void assertEquals(Character expected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertEquals
@API(status=STABLE, since="5.4") public static void assertEquals(Character expected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertEquals
public static void assertEquals(Object expected, Object actual)
Assert thatexpected
andactual
are equal.If both are
null
, they are considered equal.- See Also:
Object.equals(Object)
-
assertEquals
public static void assertEquals(Object expected, Object actual, String message)
Assert thatexpected
andactual
are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.- See Also:
Object.equals(Object)
-
assertEquals
public static void assertEquals(Object expected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- See Also:
Object.equals(Object)
-
assertArrayEquals
public static void assertArrayEquals(boolean[] expected, boolean[] actual)
Assert thatexpected
andactual
boolean arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(boolean[] expected, boolean[] actual, String message)
Assert thatexpected
andactual
boolean arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(boolean[] expected, boolean[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
boolean arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(char[] expected, char[] actual)
Assert thatexpected
andactual
char arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(char[] expected, char[] actual, String message)
Assert thatexpected
andactual
char arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(char[] expected, char[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
char arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(byte[] expected, byte[] actual)
Assert thatexpected
andactual
byte arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(byte[] expected, byte[] actual, String message)
Assert thatexpected
andactual
byte arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(byte[] expected, byte[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
byte arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(short[] expected, short[] actual)
Assert thatexpected
andactual
short arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(short[] expected, short[] actual, String message)
Assert thatexpected
andactual
short arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(short[] expected, short[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
short arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(int[] expected, int[] actual)
Assert thatexpected
andactual
int arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(int[] expected, int[] actual, String message)
Assert thatexpected
andactual
int arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(int[] expected, int[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
int arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(long[] expected, long[] actual)
Assert thatexpected
andactual
long arrays are equal.If both are
null
, they are considered equal.
-
assertArrayEquals
public static void assertArrayEquals(long[] expected, long[] actual, String message)
Assert thatexpected
andactual
long arrays are equal.If both are
null
, they are considered equal.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(long[] expected, long[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
long arrays are equal.If both are
null
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual)
Assert thatexpected
andactual
float arrays are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual, String message)
Assert thatexpected
andactual
float arrays are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
float arrays are equal.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual, float delta)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual, float delta, String message)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(float[] expected, float[] actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
float arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual)
Assert thatexpected
andactual
double arrays are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual, String message)
Assert thatexpected
andactual
double arrays are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
double arrays are equal.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual, double delta)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual, double delta, String message)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(double[] expected, double[] actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
double arrays are equal within the given non-negativedelta
.Equality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertArrayEquals
public static void assertArrayEquals(Object[] expected, Object[] actual)
Assert thatexpected
andactual
object arrays are deeply equal.If both are
null
, they are considered equal.Nested float arrays are checked as in
assertEquals(float, float)
.Nested double arrays are checked as in
assertEquals(double, double)
.
-
assertArrayEquals
public static void assertArrayEquals(Object[] expected, Object[] actual, String message)
Assert thatexpected
andactual
object arrays are deeply equal.If both are
null
, they are considered equal.Nested float arrays are checked as in
assertEquals(float, float)
.Nested double arrays are checked as in
assertEquals(double, double)
.Fails with the supplied failure
message
.
-
assertArrayEquals
public static void assertArrayEquals(Object[] expected, Object[] actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
object arrays are deeply equal.If both are
null
, they are considered equal.Nested float arrays are checked as in
assertEquals(float, float)
.Nested double arrays are checked as in
assertEquals(double, double)
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertIterableEquals
public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual)
Assert thatexpected
andactual
iterables are deeply equal.Similarly to the check for deep equality in
assertArrayEquals(Object[], Object[])
, if two iterables are encountered (includingexpected
andactual
) then their iterators must return equal elements in the same order as each other. Note: this means that the iterables do not need to be of the same type. Example:import static java.util.Arrays.asList; . . . Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); assertIterableEquals(i0, i1); // Passes
If both
expected
andactual
arenull
, they are considered equal.
-
assertIterableEquals
public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, String message)
Assert thatexpected
andactual
iterables are deeply equal.Similarly to the check for deep equality in
assertArrayEquals(Object[], Object[], String)
, if two iterables are encountered (includingexpected
andactual
) then their iterators must return equal elements in the same order as each other. Note: this means that the iterables do not need to be of the same type. Example:import static java.util.Arrays.asList; . . . Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); assertIterableEquals(i0, i1); // Passes
If both
expected
andactual
arenull
, they are considered equal.Fails with the supplied failure
message
.
-
assertIterableEquals
public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
iterables are deeply equal.Similarly to the check for deep equality in
assertArrayEquals(Object[], Object[], Supplier)
, if two iterables are encountered (includingexpected
andactual
) then their iterators must return equal elements in the same order as each other. Note: this means that the iterables do not need to be of the same type. Example:import static java.util.Arrays.asList; . . . Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); assertIterableEquals(i0, i1); // Passes
If both
expected
andactual
arenull
, they are considered equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertLinesMatch
public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines)
Assert thatexpected
list of Strings matchesactual
list.This method differs from other assertions that effectively only check
String.equals(Object)
, in that it uses the following staged matching algorithm:For each pair of expected and actual lines do
- check if
expected.equals(actual)
- if yes, continue with next pair - otherwise treat
expected
as a regular expression and check viaString.matches(String)
- if yes, continue with next pair - otherwise check if
expected
line is a fast-forward marker, if yes apply fast-forward actual lines accordingly (see below) and goto 1.
A valid fast-forward marker is an expected line that starts and ends with the literal
>>
and contains at least 4 characters. Examples:>>>>
>> stacktrace >>
>> single line, non Integer.parse()-able comment >>
Skip arbitrary number of actual lines, until first matching subsequent expected line is found. Any character between the fast-forward literals are discarded.">> 21 >>"
Skip strictly 21 lines. If they can't be skipped for any reason, an assertion error is raised.
Here is an example showing all three kinds of expected line formats:
ls -la / total [\d]+ drwxr-xr-x 0 root root 512 Jan 1 1970 . drwxr-xr-x 0 root root 512 Jan 1 1970 .. drwxr-xr-x 0 root root 512 Apr 5 07:45 bin >> 4 >> -rwxr-xr-x 1 root root [\d]+ Jan 1 1970 init >> M A N Y M O R E E N T R I E S >> drwxr-xr-x 0 root root 512 Sep 22 2017 var
Fails with a generated failure message describing the difference.
- check if
-
assertLinesMatch
public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, String message)
Assert thatexpected
list of Strings matchesactual
list.Find a detailed description of the matching algorithm in
assertLinesMatch(List, List)
.Fails with the supplied failure
message
and the generated message.- See Also:
assertLinesMatch(List, List)
-
assertLinesMatch
public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, Supplier<String> messageSupplier)
Assert thatexpected
list of Strings matchesactual
list.Find a detailed description of the matching algorithm in
assertLinesMatch(List, List)
.If necessary, a custom failure message will be retrieved lazily from the supplied
messageSupplier
. Fails with the custom failure message prepended to a generated failure message describing the difference.- See Also:
assertLinesMatch(List, List)
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, byte actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, Byte actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, byte actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, Byte actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, byte actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, Byte actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, byte actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, Byte actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(byte unexpected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Byte unexpected, Byte actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, short actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, Short actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, short actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, Short actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, short actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, Short actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, short actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, Short actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(short unexpected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Short unexpected, Short actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, int actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, Integer actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, int actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, Integer actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, int actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, Integer actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, int actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, Integer actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(int unexpected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, int actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Integer unexpected, Integer actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, long actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, Long actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, long actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, Long actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, long actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, Long actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, long actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, Long actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(long unexpected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Long unexpected, Long actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, Float actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, float actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, Float actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, Float actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, float actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, Float actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Float unexpected, Float actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual, float delta)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual, float delta, String message)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(float unexpected, float actual, float delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Float.equals(Object)
andFloat.compare(float, float)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, Double actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, double actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, Double actual)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, Double actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, double actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, Double actual, String message)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Double unexpected, Double actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual, double delta)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual, double delta, String message)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(double unexpected, double actual, double delta, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal within the givendelta
.Inequality imposed by this method is consistent with
Double.equals(Object)
andDouble.compare(double, double)
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, char actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, Character actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, char actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, Character actual)
Assert thatexpected
andactual
are not equal.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, char actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, Character actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, char actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, Character actual, String message)
Assert thatexpected
andactual
are not equal.Fails with the supplied failure
message
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(char unexpected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, char actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
@API(status=STABLE, since="5.4") public static void assertNotEquals(Character unexpected, Character actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.4
-
assertNotEquals
public static void assertNotEquals(Object unexpected, Object actual)
Assert thatexpected
andactual
are not equal.Fails if both are
null
.- See Also:
Object.equals(Object)
-
assertNotEquals
public static void assertNotEquals(Object unexpected, Object actual, String message)
Assert thatexpected
andactual
are not equal.Fails if both are
null
.Fails with the supplied failure
message
.- See Also:
Object.equals(Object)
-
assertNotEquals
public static void assertNotEquals(Object unexpected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
are not equal.Fails if both are
null
.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- See Also:
Object.equals(Object)
-
assertSame
public static void assertSame(Object expected, Object actual)
Assert thatexpected
andactual
refer to the same object.
-
assertSame
public static void assertSame(Object expected, Object actual, String message)
Assert thatexpected
andactual
refer to the same object.Fails with the supplied failure
message
.
-
assertSame
public static void assertSame(Object expected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
refer to the same object.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertNotSame
public static void assertNotSame(Object unexpected, Object actual)
Assert thatexpected
andactual
do not refer to the same object.
-
assertNotSame
public static void assertNotSame(Object unexpected, Object actual, String message)
Assert thatexpected
andactual
do not refer to the same object.Fails with the supplied failure
message
.
-
assertNotSame
public static void assertNotSame(Object unexpected, Object actual, Supplier<String> messageSupplier)
Assert thatexpected
andactual
do not refer to the same object.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertAll
public static void assertAll(Executable... executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.See Javadoc for
assertAll(String, Stream)
for an explanation of this method's exception handling semantics.
-
assertAll
public static void assertAll(String heading, Executable... executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.See Javadoc for
assertAll(String, Stream)
for an explanation of this method's exception handling semantics.
-
assertAll
public static void assertAll(Collection<Executable> executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.See Javadoc for
assertAll(String, Stream)
for an explanation of this method's exception handling semantics.
-
assertAll
public static void assertAll(String heading, Collection<Executable> executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.See Javadoc for
assertAll(String, Stream)
for an explanation of this method's exception handling semantics.
-
assertAll
public static void assertAll(Stream<Executable> executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.See Javadoc for
assertAll(String, Stream)
for an explanation of this method's exception handling semantics.
-
assertAll
public static void assertAll(String heading, Stream<Executable> executables) throws MultipleFailuresError
Assert that all suppliedexecutables
do not throw exceptions.If any supplied
Executable
throws an exception (i.e., aThrowable
or any subclass thereof), all remainingexecutables
will still be executed, and all exceptions will be aggregated and reported in aMultipleFailuresError
. In addition, all aggregated exceptions will be added as suppressed exceptions to theMultipleFailuresError
. However, if anexecutable
throws a blacklisted exception — for example, anOutOfMemoryError
— execution will halt immediately, and the blacklisted exception will be rethrown as is but masked as an unchecked exception.The supplied
heading
will be included in the message string for theMultipleFailuresError
.
-
assertThrows
public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.If no exception is thrown, or if an exception of a different type is thrown, this method will fail.
If you do not want to perform additional checks on the exception instance, simply ignore the return value.
-
assertThrows
public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, String message)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.If no exception is thrown, or if an exception of a different type is thrown, this method will fail.
If you do not want to perform additional checks on the exception instance, simply ignore the return value.
Fails with the supplied failure
message
.
-
assertThrows
public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
throws an exception of theexpectedType
and return the exception.If no exception is thrown, or if an exception of a different type is thrown, this method will fail.
If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.If you do not want to perform additional checks on the exception instance, simply ignore the return value.
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static void assertDoesNotThrow(Executable executable)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
- Since:
- 5.2
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static void assertDoesNotThrow(Executable executable, String message)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
Fails with the supplied failure
message
.- Since:
- 5.2
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static void assertDoesNotThrow(Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
does not throw any kind of exception.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- Since:
- 5.2
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.If the assertion passes, the
supplier
's result will be returned.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
- Since:
- 5.2
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.If the assertion passes, the
supplier
's result will be returned.Fails with the supplied failure
message
.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
- Since:
- 5.2
-
assertDoesNotThrow
@API(status=STABLE, since="5.2") public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
does not throw any kind of exception.If the assertion passes, the
supplier
's result will be returned.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.Usage Note
Although any exception thrown from a test method will cause the test to fail, there are certain use cases where it can be beneficial to explicitly assert that an exception is not thrown for a given code block within a test method.
- Since:
- 5.2
-
assertTimeout
public static void assertTimeout(Duration timeout, Executable executable)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in the same thread as that of the calling code. Consequently, execution of theexecutable
will not be preemptively aborted if the timeout is exceeded.
-
assertTimeout
public static void assertTimeout(Duration timeout, Executable executable, String message)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in the same thread as that of the calling code. Consequently, execution of theexecutable
will not be preemptively aborted if the timeout is exceeded.Fails with the supplied failure
message
.
-
assertTimeout
public static void assertTimeout(Duration timeout, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in the same thread as that of the calling code. Consequently, execution of theexecutable
will not be preemptively aborted if the timeout is exceeded.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertTimeout
public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in the same thread as that of the calling code. Consequently, execution of thesupplier
will not be preemptively aborted if the timeout is exceeded.
-
assertTimeout
public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in the same thread as that of the calling code. Consequently, execution of thesupplier
will not be preemptively aborted if the timeout is exceeded.Fails with the supplied failure
message
.
-
assertTimeout
public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in the same thread as that of the calling code. Consequently, execution of thesupplier
will not be preemptively aborted if the timeout is exceeded.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.
-
assertTimeoutPreemptively
public static void assertTimeoutPreemptively(Duration timeout, Executable executable)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in a different thread than that of the calling code. Furthermore, execution of theexecutable
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.- See Also:
assertTimeoutPreemptively(Duration, Executable, String)
,assertTimeoutPreemptively(Duration, Executable, Supplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, String)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier)
,assertTimeout(Duration, Executable)
-
assertTimeoutPreemptively
public static void assertTimeoutPreemptively(Duration timeout, Executable executable, String message)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in a different thread than that of the calling code. Furthermore, execution of theexecutable
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.Fails with the supplied failure
message
.- See Also:
assertTimeoutPreemptively(Duration, Executable)
,assertTimeoutPreemptively(Duration, Executable, Supplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, String)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier)
,assertTimeout(Duration, Executable, String)
-
assertTimeoutPreemptively
public static void assertTimeoutPreemptively(Duration timeout, Executable executable, Supplier<String> messageSupplier)
Assert that execution of the suppliedexecutable
completes before the giventimeout
is exceeded.Note: the
executable
will be executed in a different thread than that of the calling code. Furthermore, execution of theexecutable
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- See Also:
assertTimeoutPreemptively(Duration, Executable)
,assertTimeoutPreemptively(Duration, Executable, String)
,assertTimeoutPreemptively(Duration, ThrowingSupplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, String)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier)
,assertTimeout(Duration, Executable, Supplier)
-
assertTimeoutPreemptively
public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in a different thread than that of the calling code. Furthermore, execution of thesupplier
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.- See Also:
assertTimeoutPreemptively(Duration, Executable)
,assertTimeoutPreemptively(Duration, Executable, String)
,assertTimeoutPreemptively(Duration, Executable, Supplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, String)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier)
,assertTimeout(Duration, Executable)
-
assertTimeoutPreemptively
public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, String message)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in a different thread than that of the calling code. Furthermore, execution of thesupplier
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.Fails with the supplied failure
message
.- See Also:
assertTimeoutPreemptively(Duration, Executable)
,assertTimeoutPreemptively(Duration, Executable, String)
,assertTimeoutPreemptively(Duration, Executable, Supplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier)
,assertTimeout(Duration, Executable, String)
-
assertTimeoutPreemptively
public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier)
Assert that execution of the suppliedsupplier
completes before the giventimeout
is exceeded.If the assertion passes then the
supplier
's result is returned.Note: the
supplier
will be executed in a different thread than that of the calling code. Furthermore, execution of thesupplier
will be preemptively aborted if the timeout is exceeded. See the Preemptive Timeouts section of the class-level Javadoc for a discussion of possible undesirable side effects.If necessary, the failure message will be retrieved lazily from the supplied
messageSupplier
.- See Also:
assertTimeoutPreemptively(Duration, Executable)
,assertTimeoutPreemptively(Duration, Executable, String)
,assertTimeoutPreemptively(Duration, Executable, Supplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier)
,assertTimeoutPreemptively(Duration, ThrowingSupplier, String)
,assertTimeout(Duration, Executable, Supplier)
-
-