Package com.soebes.itf.jupiter.extension
Class Preconditions
java.lang.Object
com.soebes.itf.jupiter.extension.Preconditions
- Author:
- Karl Heinz Marbaise
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]requireGreaterZero(T[] parameter, String message) Check that the given array has a length which is greater than zero.static StringrequireNotEmpty(String parameter, String message) Check that the given parameter is not empty.static <T> TrequireNotNull(T parameter, String message) Check that the given parameter is notnull.
-
Method Details
-
requireNotNull
Check that the given parameter is notnull.- Parameters:
parameter- The parameter which is checked not to benull.message- The message which is thrown in the exception.- Returns:
- the given paremter in case not being
null. - Throws:
IllegalArgumentException- in case of parameter isnull.
-
requireGreaterZero
Check that the given array has a length which is greater than zero.- Type Parameters:
T- The type of the parameter.- Parameters:
parameter- The array parameter of which the length will be checked.message- The message to thrown in case of not fulfilling the condition.- Returns:
- Return the original
paramterif not raised the execption. - Throws:
IllegalArgumentException- in case the condition has not been fulfilled.
-
requireNotEmpty
Check that the given parameter is not empty.- Parameters:
parameter- The String parameter which should not be empty.message- The message to thrown in case of not fulfilling the condition.- Returns:
- Return the original
parameterif not raised the execption. - Throws:
IllegalArgumentException- in case the condition has not been fulfilled.
-