public abstract class Assert extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
isFalse(boolean expression,
Supplier<String> messageSupplier)
Asserts that the given
expression is false. |
static void |
isTrue(boolean expression,
Supplier<String> messageSupplier)
Asserts that the given
expression is true. |
static <T> T |
nonNull(T value,
Supplier<String> messageSupplier)
Assert that the given
value is not null. |
static void |
notNull(Object value,
Supplier<String> messageSupplier)
Assert that the given
value is not null. |
static void |
state(boolean state,
Supplier<String> messageSupplier)
Asserts that the value of
state is true. |
public static void state(boolean state,
Supplier<String> messageSupplier)
state is true. If not, an IllegalStateException is thrown.state - the state validation expressionmessageSupplier - Supplier of the exception message if state evaluates to falsepublic static void isTrue(boolean expression,
Supplier<String> messageSupplier)
expression is true. If not, an IllegalArgumentException is thrown.expression - the state validation expressionmessageSupplier - Supplier of the exception message if the expression evaluates to falsepublic static void isFalse(boolean expression,
Supplier<String> messageSupplier)
expression is false. If not, an IllegalArgumentException is thrown.expression - the state validation expressionmessageSupplier - Supplier of the exception message if the expression evaluates to truepublic static void notNull(Object value, Supplier<String> messageSupplier)
value is not null. If not, an IllegalArgumentException is
thrown.value - the value not to be nullmessageSupplier - Supplier of the exception message if the assertion failspublic static <T> T nonNull(T value,
Supplier<String> messageSupplier)
value is not null. If not, an IllegalArgumentException is
thrown.value - the value not to be nullmessageSupplier - Supplier of the exception message if the assertion failsvalueCopyright © 2010–2018. All rights reserved.