Record Class AssertionResult.Failure

java.lang.Object
java.lang.Record
cloud.opencode.base.test.assertion.AssertionResult.Failure
Record Components:
message - the failure message | 失败消息
expected - the expected value | 期望值
actual - the actual value | 实际值
All Implemented Interfaces:
AssertionResult
Enclosing interface:
AssertionResult

public static record AssertionResult.Failure(String message, Object expected, Object actual) extends Record implements AssertionResult
Failure assertion result. 失败断言结果。
Since:
JDK 25, opencode-base-test V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Failure

      public Failure(String message, Object expected, Object actual)
      Creates an instance of a Failure record class.
      Parameters:
      message - the value for the message record component
      expected - the value for the expected record component
      actual - the value for the actual record component
  • Method Details

    • passed

      public boolean passed()
      Description copied from interface: AssertionResult
      Whether the assertion passed. 断言是否通过。
      Specified by:
      passed in interface AssertionResult
      Returns:
      true if passed | 如果通过返回 true
    • hasValues

      public boolean hasValues()
      Whether this failure has expected/actual values. 此失败是否有期望值/实际值。
      Returns:
      true if has values | 如果有值返回 true
    • toString

      public 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.
    • message

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

      public Object expected()
      Returns the value of the expected record component.
      Returns:
      the value of the expected record component
    • actual

      public Object actual()
      Returns the value of the actual record component.
      Returns:
      the value of the actual record component