Record Class TestReport.TestResult

java.lang.Object
java.lang.Record
cloud.opencode.base.test.report.TestReport.TestResult
Record Components:
testName - the test name | 测试名称
status - the status | 状态
duration - the duration | 时长
error - the error (if failed) | 错误(如果失败)
message - the message | 消息
Enclosing class:
TestReport

public static record TestReport.TestResult(String testName, TestReport.TestStatus status, Duration duration, Throwable error, String message) extends Record
Test result 测试结果
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • TestResult

      public TestResult(String testName, TestReport.TestStatus status, Duration duration, Throwable error, String message)
      Creates an instance of a TestResult record class.
      Parameters:
      testName - the value for the testName record component
      status - the value for the status record component
      duration - the value for the duration record component
      error - the value for the error record component
      message - the value for the message record component
  • Method Details

    • passed

      public static TestReport.TestResult passed(String testName, Duration duration)
    • failed

      public static TestReport.TestResult failed(String testName, Duration duration, Throwable error)
    • skipped

      public static TestReport.TestResult skipped(String testName, String reason)
    • name

      public String name()
    • passed

      public boolean passed()
    • durationMs

      public long durationMs()
    • errorMessage

      public String errorMessage()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • testName

      public String testName()
      Returns the value of the testName record component.
      Returns:
      the value of the testName record component
    • status

      public TestReport.TestStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • duration

      public Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • error

      public Throwable error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component