Class TestDataGenerator

java.lang.Object
cloud.opencode.base.test.data.TestDataGenerator

public final class TestDataGenerator extends Object
Test Data Generator 测试数据生成器

Generates random test data.

生成随机测试数据。

Features | 主要功能:

  • Random test data generation - 随机测试数据生成
  • Names, emails, dates, numbers - 姓名、邮件、日期、数字

Usage Examples | 使用示例:

String name = TestDataGenerator.randomFullName();
String email = TestDataGenerator.randomEmail();
int num = TestDataGenerator.randomInt(1, 100);

Security | 安全性:

  • Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • randomString

      public static String randomString(int length)
    • randomAlpha

      public static String randomAlpha(int length)
    • randomNumeric

      public static String randomNumeric(int length)
    • uuid

      public static String uuid()
    • shortUuid

      public static String shortUuid()
    • randomFirstName

      public static String randomFirstName()
    • randomLastName

      public static String randomLastName()
    • randomFullName

      public static String randomFullName()
    • randomEmail

      public static String randomEmail()
    • randomPhone

      public static String randomPhone()
    • randomInt

      public static int randomInt()
    • randomInt

      public static int randomInt(int max)
    • randomInt

      public static int randomInt(int min, int max)
    • randomLong

      public static long randomLong()
    • randomLong

      public static long randomLong(long max)
    • randomDouble

      public static double randomDouble()
    • randomDouble

      public static double randomDouble(double max)
    • randomBoolean

      public static boolean randomBoolean()
    • randomInstant

      public static Instant randomInstant()
    • randomDate

      public static LocalDate randomDate()
    • randomDateTime

      public static LocalDateTime randomDateTime()
    • randomStrings

      public static List<String> randomStrings(int count, int length)
    • randomInts

      public static List<Integer> randomInts(int count, int max)
    • randomBytes

      public static byte[] randomBytes(int length)
    • oneOf

      @SafeVarargs public static <T> T oneOf(T... options)
    • oneOf

      public static <T> T oneOf(List<T> options)