Package org.fluentlenium.utils
Class Preconditions
- java.lang.Object
-
- org.fluentlenium.utils.Preconditions
-
public final class Preconditions extends java.lang.Object
Utility methods for validating objects' status.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
checkArgument(T object, java.lang.String message)
Validates if the argument object is null, and throws anIllegalArgumentException
if it is.static java.lang.String
checkArgumentBlank(java.lang.String object, java.lang.String message)
Validates if the argument String is blank, and throws anIllegalArgumentException
if it is.static <T> T
checkState(T object, java.lang.String message)
Validates if the argument object is null, and throws anIllegalStateException
if it is.
-
-
-
Method Detail
-
checkArgument
public static <T> T checkArgument(T object, java.lang.String message)
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:
java.lang.IllegalArgumentException
- if the argument object is null
-
checkArgumentBlank
public static java.lang.String checkArgumentBlank(java.lang.String object, java.lang.String message)
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:
java.lang.IllegalArgumentException
- if the argument String is blank
-
checkState
public static <T> T checkState(T object, java.lang.String message)
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:
java.lang.IllegalStateException
- if the argument object is null
-
-