Class TestException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AssertionException, BenchmarkException, DataGenerationException, MockException

public class TestException extends RuntimeException
Test Exception 测试异常

Exception thrown during test execution.

测试执行期间抛出的异常。

Features | 主要功能:

  • Test execution exception handling - 测试执行异常处理
  • Error code support - 错误码支持

Usage Examples | 使用示例:

throw new TestException(TestErrorCode.ASSERTION_FAILED, "Values differ");

Security | 安全性:

  • Thread-safe: No - 线程安全: 否
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • TestException

      public TestException(TestErrorCode errorCode)
      Create test exception 创建测试异常
      Parameters:
      errorCode - the error code | 错误码
    • TestException

      public TestException(TestErrorCode errorCode, String detail)
      Create test exception with detail 创建带详情的测试异常
      Parameters:
      errorCode - the error code | 错误码
      detail - the detail message | 详细消息
    • TestException

      public TestException(TestErrorCode errorCode, Throwable cause)
      Create test exception with cause 创建带原因的测试异常
      Parameters:
      errorCode - the error code | 错误码
      cause - the cause | 原因
    • TestException

      public TestException(String message)
      Create test exception with message 创建带消息的测试异常
      Parameters:
      message - the message | 消息
    • TestException

      public TestException(String message, Throwable cause)
      Create test exception with message and cause 创建带消息和原因的测试异常
      Parameters:
      message - the message | 消息
      cause - the cause | 原因
  • Method Details

    • getErrorCode

      public TestErrorCode getErrorCode()
      Get error code 获取错误码
      Returns:
      the error code | 错误码