Class TestingUtils

java.lang.Object
rife.bld.extension.testing.TestingUtils

public final class TestingUtils extends Object
Utility class that provides methods for generating random values and predefined character sets..
Since:
1.0
Author:
Erik C. Thauvin
  • Field Details

    • ALPHANUMERIC_CHARACTERS

      public static final String ALPHANUMERIC_CHARACTERS
      A string constant containing all uppercase letters, lowercase letters, and numeric digits.
      See Also:
    • HEXADECIMAL_CHARACTERS

      public static final String HEXADECIMAL_CHARACTERS
      A string constant containing all hexadecimal digits and letters.
      See Also:
    • LOWERCASE_CHARACTERS

      public static final String LOWERCASE_CHARACTERS
      A string constant containing all lowercase letters.
      See Also:
    • NUMERIC_CHARACTERS

      public static final String NUMERIC_CHARACTERS
      A string constant containing all numeric digits.
      See Also:
    • UPPERCASE_CHARACTERS

      public static final String UPPERCASE_CHARACTERS
      A string constant containing all uppercase letters.
      See Also:
    • URL_SAFE_CHARACTERS

      public static final String URL_SAFE_CHARACTERS
      A string constant representing a set of characters that are safe for use in URLs.

      It includes uppercase and lowercase letters, digits, and the symbols - and _.

      See Also:
  • Method Details

    • generateRandomInt

      public static int generateRandomInt(int min, int max)
      Generates a random integer within the specified range.
      Parameters:
      min - the minimum value (inclusive) of the random number
      max - the maximum value (inclusive) of the random number
      Returns:
      a random integer between min and max, inclusive
      Throws:
      IllegalArgumentException - if min is greater than max
    • generateRandomString

      public static String generateRandomString(int length, String characters)
      Generates a random string with specified parameters.
      Parameters:
      length - the desired length of the generated string
      characters - the character set to use
      Returns:
      a randomly generated string of the specified length
      Throws:
      IllegalArgumentException - if the length is non-positive or the character set is null/empty
    • generateRandomString

      public static String generateRandomString()
      Generates a random string with default parameters.
      Returns:
      a 10-character random alphanumeric string
    • generateRandomString

      public static String generateRandomString(int length)
      Generates a random string with a specified length.
      Parameters:
      length - the desired length of the generated string
      Returns:
      a random alphanumeric string of the specified length
      Throws:
      IllegalArgumentException - if length is non-positive