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> TcheckArgument(T object, String message) Validates if the argument object is null, and throws anIllegalArgumentExceptionif it is.static StringcheckArgumentBlank(String object, String message) Validates if the argument String is blank, and throws anIllegalArgumentExceptionif it is.static <T> TcheckState(T object, String message) Validates if the argument object is null, and throws anIllegalStateExceptionif it is.
-
Method Details
-
checkArgument
Validates if the argument object is null, and throws anIllegalArgumentExceptionif 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 anIllegalArgumentExceptionif 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 anIllegalStateExceptionif 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
-