Record Class TestCase

java.lang.Object
java.lang.Record
org.ek9lang.cli.TestCase
Record Components:
testProgram - The test program this case belongs to
caseId - Case identifier (null for simple tests, "1", "edge", etc. for parameterized)
arguments - Command line arguments (empty for no-arg tests)
expectedOutputFile - Path to expected_output.txt or expected_case_{caseId}.txt

public record TestCase(TestProgram testProgram, String caseId, List<String> arguments, Path expectedOutputFile) extends Record
Represents a single test case (possibly one of many for parameterized tests).

For simple tests with expected_output.txt, there is one TestCase with caseId=null. For parameterized tests with commandline_arg_*.txt files, there is one TestCase per case.

  • Constructor Details

    • TestCase

      public TestCase(TestProgram testProgram, String caseId, List<String> arguments, Path expectedOutputFile)
      Creates an instance of a TestCase record class.
      Parameters:
      testProgram - the value for the testProgram record component
      caseId - the value for the caseId record component
      arguments - the value for the arguments record component
      expectedOutputFile - the value for the expectedOutputFile record component
  • Method Details

    • isParameterized

      boolean isParameterized()
      Check if this is a parameterized test case (has a case ID).
    • getDisplayName

      String getDisplayName()
      Get the display name for this test case. For parameterized tests, includes the case ID.
    • 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.
    • testProgram

      public TestProgram testProgram()
      Returns the value of the testProgram record component.
      Returns:
      the value of the testProgram record component
    • caseId

      public String caseId()
      Returns the value of the caseId record component.
      Returns:
      the value of the caseId record component
    • arguments

      public List<String> arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component
    • expectedOutputFile

      public Path expectedOutputFile()
      Returns the value of the expectedOutputFile record component.
      Returns:
      the value of the expectedOutputFile record component