Package rife.bld.extension.junitreporter
Record Class TestFailure
java.lang.Object
java.lang.Record
rife.bld.extension.junitreporter.TestFailure
- Record Components:
testName- the test method name; never nulldisplayName- the JUnit display name extracted fromsystem-out; empty string if not presentclassName- the fully qualified test class name; never nullfailureType- the exception class name from thetypeattribute; never nullfailureMessage- the failure message from themessageattribute; never nullstackTrace- the stack trace content of thefailureorerrorelement; empty string if not presenttime- the execution time in seconds from thetimeattribute; must be >= 0
- All Implemented Interfaces:
Comparable<TestFailure>
public record TestFailure(String testName, String displayName, String className, String failureType, String failureMessage, String stackTrace, double time)
extends Record
implements Comparable<TestFailure>
Immutable record representing a test case failure extracted from JUnit XML.
Instances are naturally ordered by class name, then test name for consistent
sorting within TestClassFailures.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassNamerecord component.intcompareTo(TestFailure other) Compares this failure to another by class name, then test name.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefailureMessagerecord component.Returns the value of thefailureTyperecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thestackTracerecord component.testName()Returns the value of thetestNamerecord component.doubletime()Returns the value of thetimerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TestFailure
public TestFailure(String testName, String displayName, String className, String failureType, String failureMessage, String stackTrace, double time) Constructs a newTestFailureinstance.Normalizes
nullvalues fordisplayNameandstackTraceto empty strings.- Parameters:
testName- the test method name; must not be nulldisplayName- the JUnit display name; may be null, normalized to empty stringclassName- the fully qualified test class name; must not be nullfailureType- the exception class name; must not be nullfailureMessage- the failure message; must not be nullstackTrace- the stack trace; may be null, normalized to empty stringtime- the execution time in seconds; must be >= 0- Throws:
NullPointerException- iftestName,className,failureType, orfailureMessageis nullIllegalArgumentException- iftimeis negative
-
-
Method Details
-
compareTo
Compares this failure to another by class name, then test name.This ordering is consistent with
equalsand ensures failures are grouped by class when sorted.- Specified by:
compareToin interfaceComparable<TestFailure>- Parameters:
other- the otherTestFailureto compare to- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
-
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. -
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. -
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
testName
Returns the value of thetestNamerecord component.- Returns:
- the value of the
testNamerecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
className
Returns the value of theclassNamerecord component.- Returns:
- the value of the
classNamerecord component
-
failureType
Returns the value of thefailureTyperecord component.- Returns:
- the value of the
failureTyperecord component
-
failureMessage
Returns the value of thefailureMessagerecord component.- Returns:
- the value of the
failureMessagerecord component
-
stackTrace
Returns the value of thestackTracerecord component.- Returns:
- the value of the
stackTracerecord component
-
time
public double time()Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-