Package com.github.cukedoctor.util
Class Assert
- java.lang.Object
-
- com.github.cukedoctor.util.Assert
-
- All Implemented Interfaces:
Serializable
public class Assert extends Object implements Serializable
Created by rafael-pestano on 26/06/2015.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontains(String textToSearch, String substring)static booleanhasElements(Object[] array)static booleanhasElements(Collection array)static booleanhasText(String text)static booleanisNull(Object object)static booleannot(boolean assertion)static booleannotEmpty(Object[] array)static booleannotEmpty(Collection<?> collection)static booleannotEmpty(Map<?,?> map)static booleannotNull(Object object)static booleannotNull(Object[] array)Assert that an array has no null elements.
-
-
-
Method Detail
-
notNull
public static boolean notNull(Object object)
- Parameters:
object- to assert- Returns:
- TRUE assertion when given objects is not null, FALSE otherwise
-
isNull
public static boolean isNull(Object object)
- Parameters:
object- to assert- Returns:
- TRUE assertion when given objects is null, FALSE otherwise
-
not
public static boolean not(boolean assertion)
- Parameters:
assertion- expression to be negated- Returns:
- just negates the assertion
-
hasText
public static boolean hasText(String text)
- Parameters:
text- to assert- Returns:
- TRUE when given text has any character, FALSE otherwise
-
contains
public static boolean contains(String textToSearch, String substring)
- Parameters:
textToSearch- complete textsubstring- text to search in textToSearch param- Returns:
- TRUE when given text contains the given substring, FALSE otherwise
-
notEmpty
public static boolean notEmpty(Object[] array)
- Parameters:
array- list to check emptiness- Returns:
- TRUE when given array has elements; that is, it must not be
nulland must have at least one element. FALSE otherwise
-
notEmpty
public static boolean notEmpty(Collection<?> collection)
- Parameters:
collection- collection to check emptiness- Returns:
- TRUE when given collection has elements; that is, it must not be
nulland must have at least one element. @return FALSE otherwise
-
hasElements
public static boolean hasElements(Object[] array)
- Parameters:
array- to check elements- Returns:
- TRUE when given array has at least one not null element; FALSE otherwise
-
hasElements
public static boolean hasElements(Collection array)
- Parameters:
array- to check elements- Returns:
- TRUE when given array has at least one not null element; FALSE otherwise
-
notEmpty
public static boolean notEmpty(Map<?,?> map)
- Parameters:
map- to check emptiness- Returns:
- TRUE if given Map has entries; that is, it must not be
nulland must have at least one entry. Queue FALSE otherwise
-
notNull
public static boolean notNull(Object[] array)
Assert that an array has no null elements. Note: Does not complain if the array is empty!Assert.noNullElements(array, "The array must have non-null elements");
- Parameters:
array- the array- Returns:
- TRUE when given array has no null elements; FALSE otherwise
-
-