java.lang.Object
io.lettuce.core.internal.LettuceAssert
public class LettuceAssert extends Object
Assertion utility class that assists in validating arguments. This class is part of the internal API and may change without
further notice.
- Author:
- Mark Paluch
-
Method Summary
Modifier and Type Method Description static voidassertState(boolean condition, String message)Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static voidassertState(boolean condition, Supplier<String> messageSupplier)Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.static voidisTrue(boolean value, String message)Assert thatvalueistrue.static voidisTrue(boolean value, Supplier<String> messageSupplier)Assert thatvalueistrue.static voidnoNullElements(Object[] array, String message)Assert that an array has no null elements.static voidnoNullElements(Object[] array, Supplier<String> messageSupplier)Assert that an array has no null elements.static voidnoNullElements(Collection<?> c, String message)Assert that aCollectionhas no null elements.static voidnoNullElements(Collection<?> c, Supplier<String> messageSupplier)Assert that aCollectionhas no null elements.static voidnotEmpty(int[] array, String message)Assert that an array has elements; that is, it must not benulland must have at least one element.static voidnotEmpty(CharSequence string, String message)Assert that a string is not empty, it must not benulland it must not be empty.static voidnotEmpty(CharSequence string, Supplier<String> messageSupplier)Assert that a string is not empty, it must not benulland it must not be empty.static voidnotEmpty(Object[] array, String message)Assert that an array has elements; that is, it must not benulland must have at least one element.static voidnotEmpty(Object[] array, Supplier<String> messageSupplier)Assert that an array has elements; that is, it must not benulland must have at least one element.static voidnotNull(Object object, String message)Assert that an object is notnull.static voidnotNull(Object object, Supplier<String> messageSupplier)Assert that an object is notnull.
-
Method Details
-
notEmpty
Assert that a string is not empty, it must not benulland it must not be empty.- Parameters:
string- the object to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object isnullor the underlying string is empty
-
notEmpty
Assert that a string is not empty, it must not benulland it must not be empty.- Parameters:
string- the object to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if the object isnullor the underlying string is empty- Since:
- 5.2.0
-
notNull
Assert that an object is notnull.- Parameters:
object- the object to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object isnull
-
notNull
Assert that an object is notnull.- Parameters:
object- the object to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if the object isnull- Since:
- 5.2.0
-
notEmpty
Assert that an array has elements; that is, it must not benulland must have at least one element.- Parameters:
array- the array to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object array isnullor has no elements
-
notEmpty
Assert that an array has elements; that is, it must not benulland must have at least one element.- Parameters:
array- the array to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if the object array isnullor has no elements- Since:
- 5.2.0
-
notEmpty
Assert that an array has elements; that is, it must not benulland must have at least one element.- Parameters:
array- the array to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object array isnullor has no elements
-
noNullElements
Assert that an array has no null elements.- Parameters:
array- the array to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object array contains anullelement
-
noNullElements
Assert that an array has no null elements.- Parameters:
array- the array to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if the object array contains anullelement- Since:
- 5.2.0
-
noNullElements
Assert that aCollectionhas no null elements.- Parameters:
c- the collection to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if theCollectioncontains anullelement
-
noNullElements
Assert that aCollectionhas no null elements.- Parameters:
c- the collection to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if theCollectioncontains anullelement- Since:
- 5.2.0
-
isTrue
Assert thatvalueistrue.- Parameters:
value- the value to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object array contains anullelement
-
isTrue
Assert thatvalueistrue.- Parameters:
value- the value to checkmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalArgumentException- if the object array contains anullelement- Since:
- 5.2.0
-
assertState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.- Parameters:
condition- a boolean expressionmessage- the exception message to use if the assertion fails- Throws:
IllegalStateException- ifexpressionis false
-
assertState
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.- Parameters:
condition- a boolean expressionmessageSupplier- the exception message supplier to use if the assertion fails- Throws:
IllegalStateException- ifexpressionis false- Since:
- 5.2.0
-