Class Require

java.lang.Object
org.openqa.selenium.internal.Require

@NullMarked public final class Require extends Object
A utility class to check arguments (preconditions) and state.

Examples of use:

   public void setActionWithTimeout(Action action delegate, int timeout) {
     this.action = Require.nonNull("Action", action);
     this.timeout = Require.positive("Timeout", timeout);
   }
 
  • Method Details

    • precondition

      public static void precondition(boolean condition, String message, Object... args)
    • nonNull

      public static <T> T nonNull(String argName, @Nullable T arg)
    • nonNull

      public static <T> T nonNull(String argName, @Nullable T arg, String message, Object... args)
    • isNull

      public static <T> void isNull(String argName, @Nullable T arg)
    • argument

      public static <T> Require.ArgumentChecker<T> argument(String argName, @Nullable T arg)
    • nonNegative

      public static Duration nonNegative(String argName, @Nullable Duration arg)
    • nonNegative

      public static Duration nonNegative(@Nullable Duration arg)
    • positive

      public static Duration positive(String argName, @Nullable Duration arg)
    • positive

      public static Duration positive(@Nullable Duration arg)
    • nonNegative

      public static int nonNegative(String argName, @Nullable Integer number)
    • nonNegative

      public static long nonNegative(String argName, @Nullable Long number)
    • nonNegative

      public static double nonNegative(String argName, @Nullable Double number)
    • positive

      public static int positive(String argName, @Nullable Integer number, @Nullable String message)
    • positive

      public static double positive(String argName, @Nullable Double number, @Nullable String message)
    • positive

      public static double positive(String argName, @Nullable Double number)
    • positive

      public static int positive(String argName, @Nullable Integer number)
    • positive

      public static long positive(String argName, @Nullable Long number)
    • inRangeInclusive

      public static double inRangeInclusive(String argName, @Nullable Double value, double min, double max)
    • argument

      public static Require.IntChecker argument(String argName, @Nullable Integer number)
    • argument

      public static Require.PathChecker argument(String argName, @Nullable Path path)
    • nonEmpty

      public static <T> Collection<T> nonEmpty(String argName, @Nullable Collection<T> arg)
    • nonBlank

      public static String nonBlank(String argName, @Nullable String arg)
    • nonEmpty

      public static String nonEmpty(String argName, @Nullable String arg)
    • stateCondition

      public static void stateCondition(boolean state, String message, Object... args)
    • state

      public static <T> Require.StateChecker<T> state(String name, @Nullable T state)
    • state

      public static Require.PathStateChecker state(String name, @Nullable Path path)