Package io.fluentlenium.utils
Class Preconditions
java.lang.Object
io.fluentlenium.utils.Preconditions
Utility methods for validating objects' status.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
checkArgument
(T object, String message) Validates if the argument object is null, and throws anIllegalArgumentException
if it is.static String
checkArgumentBlank
(String object, String message) Validates if the argument String is blank, and throws anIllegalArgumentException
if it is.static <T> T
checkState
(T object, String message) Validates if the argument object is null, and throws anIllegalStateException
if it is.
-
Method Details
-
checkArgument
Validates if the argument object is null, and throws anIllegalArgumentException
if it is.- Type Parameters:
T
- object to check- Parameters:
object
- the object to validatemessage
- the error message to throw the exception with- Returns:
- the argument object if it is not null
- Throws:
IllegalArgumentException
- if the argument object is null
-
checkArgumentBlank
Validates if the argument String is blank, and throws anIllegalArgumentException
if it is.- Parameters:
object
- the object to validatemessage
- the error message to throw the exception with- Returns:
- the argument String if it is not blank
- Throws:
IllegalArgumentException
- if the argument String is blank
-
checkState
Validates if the argument object is null, and throws anIllegalStateException
if it is.- Type Parameters:
T
- object to check- Parameters:
object
- the object to validatemessage
- the error message to throw the exception with- Returns:
- the argument object if it is not null
- Throws:
IllegalStateException
- if the argument object is null
-