public class Expect extends Object
Various assertion methods plus the ability to disable default fail-fast behavior to collect as much assertion errors as possible.
All expect-methods of this class support fail-late behavior.
Constructor and Description |
---|
Expect() |
Modifier and Type | Method and Description |
---|---|
static <T> ExpectCollection<T> |
expectCollection(Collection<T> actual)
Check for non-null
Collection and provides further checks on the
actual collection in a fluent API. |
static ExpectDouble |
expectDouble(Double actual)
Check for non-null
Double and provided further checks on the
actual double in a fluent API. |
static void |
expectEquals(Object actual,
Object expected)
Check object equality.
|
static void |
expectEquals(Object actual,
Object expected,
String msg)
Check object equality.
|
static void |
expectFalse(boolean actual) |
static void |
expectFalse(boolean actual,
String msg)
Expect that the given value is
false . |
static <K,V> ExpectMap<K,V> |
expectMap(Map<K,V> actual)
Check for non-null
Map and provides further checks on the actual
map in a fluent API. |
static void |
expectNotEquals(Object actual,
Object expected)
Check for non-equal objects.
|
static void |
expectNotEquals(Object actual,
Object expected,
String msg) |
static void |
expectNotNull(Object actual)
Expect that the given actual value is not
null . |
static void |
expectNotNull(Object actual,
String msg)
Expect that the given actual value is not
null . |
static void |
expectNull(Object actual)
Expect that the given actual value is
null . |
static void |
expectNull(Object actual,
String msg)
Expect that the given actual value is
null . |
static ExpectString |
expectString(String actual)
Check for non-null
String and provided further checks on the
actual string in a fluent API. |
static void |
expectTrue(boolean actual)
Expect that the given value is
true . |
static void |
expectTrue(boolean actual,
String msg) |
static <T extends Throwable> |
intercept(Class<T> exceptionType,
RunnableWithException throwing) |
static <T extends Throwable> |
intercept(Class<T> exceptionType,
String messageRegex,
RunnableWithException throwing) |
public static void expectNull(Object actual, String msg)
Expect that the given actual value is null
.
actual
- The actual value to check.msg
- The additional message to print in case of a failed
expectation.public static void expectNull(Object actual)
Expect that the given actual value is null
.
actual
- The actual value to check.public static void expectNotNull(Object actual, String msg)
Expect that the given actual value is not null
.
actual
- The actual value to check.msg
- The additional message to print in case of a failed
expectation.public static void expectNotNull(Object actual)
Expect that the given actual value is not null
.
actual
- The actual value to check.public static void expectEquals(Object actual, Object expected, String msg)
Check object equality.
actual
- The actual object.expected
- The expected object.msg
- An additional message to output if the expectation failed.public static void expectEquals(Object actual, Object expected)
Check object equality.
In case the expectation failed, it tried to provide detailed information about the differences.
actual
- The actual object.expected
- The expected object.public static void expectNotEquals(Object actual, Object expected)
Check for non-equal objects.
actual
- The actual object.expected
- The expected object.public static void expectTrue(boolean actual, String msg)
public static void expectTrue(boolean actual)
Expect that the given value is true
.
actual
- The value th check.public static void expectFalse(boolean actual, String msg)
Expect that the given value is false
.
actual
- The value th check.msg
- An additional message to output if the expectation failed.public static void expectFalse(boolean actual)
public static ExpectDouble expectDouble(Double actual)
Check for non-null Double
and provided further checks on the
actual double in a fluent API.
actual
- The double to check.ExpectDouble
to express further expectations on the
actual double.ExpectDouble
public static ExpectString expectString(String actual)
Check for non-null String
and provided further checks on the
actual string in a fluent API.
actual
- The string to check.ExpectString
to express further expectations on the
actual string.ExpectString
public static <T> ExpectCollection<T> expectCollection(Collection<T> actual)
Check for non-null Collection
and provides further checks on the
actual collection in a fluent API.
actual
- The Collection<T> to check.ExpectCollection
to express further expectations on the
actual collection.ExpectCollection
public static <K,V> ExpectMap<K,V> expectMap(Map<K,V> actual)
Check for non-null Map
and provides further checks on the actual
map in a fluent API.
public static <T extends Throwable> T intercept(Class<T> exceptionType, RunnableWithException throwing) throws Exception
Exception
Copyright © 2019. All rights reserved.