Class DataGenerationException

All Implemented Interfaces:
Serializable

public class DataGenerationException extends TestException
Data Generation Exception - Exception thrown during test data generation 数据生成异常 - 测试数据生成期间抛出的异常

This exception is thrown when test data generation fails.

当测试数据生成失败时抛出此异常。

Features | 主要功能:

  • Data generation failure reporting - 数据生成失败报告
  • Invalid range error reporting - 无效范围错误报告
  • Factory methods for common generation errors - 常见生成错误的工厂方法

Usage Examples | 使用示例:

throw DataGenerationException.generationFailed("email");
throw DataGenerationException.invalidRange(100, 10);

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • DataGenerationException

      public DataGenerationException(TestErrorCode errorCode)
      Creates data generation exception with error code. 使用错误码创建数据生成异常。
      Parameters:
      errorCode - the error code | 错误码
    • DataGenerationException

      public DataGenerationException(TestErrorCode errorCode, String detail)
      Creates data generation exception with error code and detail. 使用错误码和详情创建数据生成异常。
      Parameters:
      errorCode - the error code | 错误码
      detail - the detail message | 详细消息
    • DataGenerationException

      public DataGenerationException(String message)
      Creates data generation exception with message. 使用消息创建数据生成异常。
      Parameters:
      message - the message | 消息
    • DataGenerationException

      public DataGenerationException(String message, Throwable cause)
      Creates data generation exception with message and cause. 使用消息和原因创建数据生成异常。
      Parameters:
      message - the message | 消息
      cause - the cause | 原因
  • Method Details

    • generationFailed

      public static DataGenerationException generationFailed(String dataType)
      Creates exception for general generation failure. 为一般生成失败创建异常。
      Parameters:
      dataType - the type of data | 数据类型
      Returns:
      the exception | 异常
    • invalidRange

      public static DataGenerationException invalidRange(Number min, Number max)
      Creates exception for invalid range. 为无效范围创建异常。
      Parameters:
      min - the minimum value | 最小值
      max - the maximum value | 最大值
      Returns:
      the exception | 异常