Class Preconditions

java.lang.Object
io.fluentlenium.utils.Preconditions

public final class Preconditions extends Object
Utility methods for validating objects' status.
  • Method Details

    • checkArgument

      public static <T> T checkArgument (T object, String message)
      Validates if the argument object is null, and throws an IllegalArgumentException if it is.
      Type Parameters:
      T - object to check
      Parameters:
      object - the object to validate
      message - 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

      public static String checkArgumentBlank (String object, String message)
      Validates if the argument String is blank, and throws an IllegalArgumentException if it is.
      Parameters:
      object - the object to validate
      message - 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

      public static <T> T checkState (T object, String message)
      Validates if the argument object is null, and throws an IllegalStateException if it is.
      Type Parameters:
      T - object to check
      Parameters:
      object - the object to validate
      message - 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