Package com.helixframework.assertion
Class Require
java.lang.Object
com.helixframework.assertion.Require
Runtime assertion helper.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of supported assertions. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSystem property that when set to anything, butfalse, will result in failed assertions being logged instead of raising exceptions. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidempty(Collection<?> collection) Requires that the collection is empty.static voidempty(Collection<?> collection, String message) Requires that the collection is empty.static voidinstanceOf(Object obj, Class<?> type) Requires that the object is an instance of the type.static voidinstanceOf(Object obj, Class<?> type, String message) Requires that the object is an instance of the type.static voidisFalse(boolean value) Requires that the boolean statement is false.static voidRequires that the boolean statement is false.static voidRequires that the function evaluates false.static voidisTrue(boolean value) Requires that the boolean statement is true.static voidRequires that the boolean statement is true.static voidRequires that the function evaluates true.static voidnonNullValue(Object obj) Requires that the object is not null.static voidnonNullValue(Object obj, String message) Requires that the object is not null.static voidnonNullValues(Object... objs) Requires that all objects are not null.static voidRequires that the string is not null or empty.static voidRequires that the string not null or empty.static voidnotEmpty(Collection<?> collection) Requires that the collection is not empty.static voidnotEmpty(Collection<?> collection, String message) Requires that the collection is not empty.static voidRequires that the object is null.static voidRequires that the object is null.static voidnullValues(Object... objs) Requires that all objects are null.static voidsize(Collection<?> collection, int size) Requires that the collection is a specific size.static voidsize(Collection<?> collection, int size, String message) Requires that the collection is a specific size.
-
Field Details
-
SUPPRESS_ASSERTION_ERRORS_SYSTEM_PROP
System property that when set to anything, butfalse, will result in failed assertions being logged instead of raising exceptions.- See Also:
-
-
Method Details
-
nonNullValue
Requires that the object is not null.- Parameters:
obj- object to check
-
nonNullValue
Requires that the object is not null.- Parameters:
obj- object to checkmessage- error message
-
nonNullValues
Requires that all objects are not null.- Parameters:
objs- objects to check
-
nullValue
Requires that the object is null.- Parameters:
obj- object to check
-
nullValue
Requires that the object is null.- Parameters:
obj- object to checkmessage- error message
-
nullValues
Requires that all objects are null.- Parameters:
objs- objects to check
-
notEmpty
Requires that the collection is not empty.- Parameters:
collection- collection to check
-
notEmpty
Requires that the collection is not empty.- Parameters:
collection- collection to checkmessage- error message
-
notEmpty
Requires that the string is not null or empty.- Parameters:
value- string to check
-
notEmpty
Requires that the string not null or empty.- Parameters:
value- string to checkmessage- error messaage
-
empty
Requires that the collection is empty.- Parameters:
collection- collection to check
-
empty
Requires that the collection is empty.- Parameters:
collection- collection to checkmessage- error message
-
size
Requires that the collection is a specific size.- Parameters:
collection- collection to checksize- collection size
-
size
Requires that the collection is a specific size.- Parameters:
collection- collection to checksize- collection sizemessage- error message
-
instanceOf
Requires that the object is an instance of the type.- Parameters:
obj- object to checktype- instance type
-
instanceOf
Requires that the object is an instance of the type.- Parameters:
obj- object to checktype- instance typemessage- error message
-
isTrue
Requires that the function evaluates true.- Parameters:
func- functionmessage- error message
-
isTrue
public static void isTrue(boolean value) Requires that the boolean statement is true.- Parameters:
value- boolean to check
-
isTrue
Requires that the boolean statement is true.- Parameters:
value- boolean to checkmessage- error message
-
isFalse
Requires that the function evaluates false.- Parameters:
func- functionmessage- error message
-
isFalse
public static void isFalse(boolean value) Requires that the boolean statement is false.- Parameters:
value- boolean to check
-
isFalse
Requires that the boolean statement is false.- Parameters:
value- boolean to checkmessage- error message
-