Package com.applitools.utils
Class ArgumentGuard
java.lang.Object
com.applitools.utils.ArgumentGuard
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidgreaterThanOrEqualToZero(long param, String paramName) Fails if the input integer parameter is negative.static voidgreaterThanZero(double param, String paramName) Fails if the input integer parameter is below or equal to 0.static voidgreaterThanZero(long param, String paramName) Fails if the input integer parameter is smaller than 1.static voidFails if the input parameter is not null.static voidisValidState(boolean isValid, String errMsg) Fails if isValid is false.static <T> voidnotContainsNull(Iterable<T> param, String paramName) Fails if the input iterable contains null elements.static <T> voidnotContainsNull(T[] param, String paramName) Fails if the input array has contains elements.static voidFails if the input parameter equals the input value.static voidFails if the input parameter is null.static voidnotNullOrEmpty(String param, String paramName) Fails if the input parameter string is null or empty.static voidFails if param is not of the expected type.static voidFails if the input integer parameter is equal to 0.
-
Method Details
-
notNull
Fails if the input parameter is null.- Parameters:
param- The input parameterparamName- The input parameter name- Throws:
IllegalArgumentException
-
notContainsNull
public static <T> void notContainsNull(Iterable<T> param, String paramName) throws IllegalArgumentException Fails if the input iterable contains null elements.- Type Parameters:
T- The type parameter- Parameters:
param- The input parameterparamName- The input parameter name- Throws:
IllegalArgumentException
-
notContainsNull
Fails if the input array has contains elements.- Type Parameters:
T- The type parameter- Parameters:
param- The input parameterparamName- The input parameter name- Throws:
IllegalArgumentException
-
notEqual
-
notNullOrEmpty
Fails if the input parameter string is null or empty.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
isNull
Fails if the input parameter is not null.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
greaterThanOrEqualToZero
public static void greaterThanOrEqualToZero(long param, String paramName) throws IllegalArgumentException Fails if the input integer parameter is negative.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
greaterThanZero
Fails if the input integer parameter is smaller than 1.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
greaterThanZero
Fails if the input integer parameter is below or equal to 0.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
notZero
Fails if the input integer parameter is equal to 0.- Parameters:
param- The input parameter.paramName- The input parameter name.- Throws:
IllegalArgumentException
-
isValidState
Fails if isValid is false.- Parameters:
isValid- Whether the current state is valid.errMsg- A description of the error.- Throws:
IllegalStateException
-
notOfType
public static void notOfType(Object param, Class paramExpectedClass, String paramName) throws IllegalArgumentException Fails if param is not of the expected type.- Parameters:
param- The input parameterparamExpectedClass- The expected type.paramName- The input parameter name.- Throws:
IllegalArgumentException
-