Class PreConditions
java.lang.Object
com.github.mjeanroy.dbunit.commons.lang.PreConditions
Static PreConditions Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkArgument
(boolean condition, String message, Object... params) static char
Ensure that givenvalue
is not blank.static String
Ensure that givenvalue
is notnull
, empty or blank.static <T> T
Ensure that givenvalue
is notnull
.static String
startsWith
(String value, String prefix, String message, Object... params) Ensure that givenvalue
is notnull
, empty or blank and starts with givenprefix
.
-
Method Details
-
notNull
Ensure that givenvalue
is notnull
.- Type Parameters:
T
- Type of value.- Parameters:
value
- Value to check.message
- Error message.params
- Optional error message parameters.- Returns:
- Value if it is not null.
- Throws:
NullPointerException
- Ifvalue
is null.
-
notBlank
Ensure that givenvalue
is notnull
, empty or blank.- Parameters:
value
- Value to check.message
- Error message.params
- Optional error message parameters.- Returns:
- Value if it is not
null
, empty or blank. - Throws:
NullPointerException
- Ifvalue
is null.IllegalArgumentException
- Ifvalue
is empty or blank.
-
notBlank
Ensure that givenvalue
is not blank.- Parameters:
value
- Value to check.message
- Error message.params
- Optional error message parameters.- Returns:
- Value if it is not
null
, empty or blank. - Throws:
NullPointerException
- Ifvalue
is null.IllegalArgumentException
- Ifvalue
is empty or blank.
-
startsWith
Ensure that givenvalue
is notnull
, empty or blank and starts with givenprefix
.- Parameters:
value
- Value to check.prefix
- The prefix to look for.message
- Error message.params
- Optional error message parameters.- Returns:
- Value if it is not
null
, empty or blank. - Throws:
NullPointerException
- Ifvalue
is null.IllegalArgumentException
- Ifvalue
is empty, blank, or does not start withprefix
.
-
checkArgument
- Parameters:
condition
- The result of the condition to verify.message
- Error message.params
- Optional error message parameters.
-