Record Class FixtureSpec

java.lang.Object
java.lang.Record
com.arc_e_tect.gradle.trackerlens.fixture.FixtureSpec
Record Components:
asOf - the instant to generate the fixture as of; defaults to Instant.now() in defaults()
historyStartDaysAgo - how many days of history, ending at asOf, the generated timestamps are spread across
forecastTargetDaysOut - how many calendar days out from asOf the calibrated forecast should land, verified against the real ProgressProjector at generation time
workingDaysPerWeek - must equal 5 - the number of business days per week ProgressProjector itself currently, non-configurably, assumes; present so a future version of this spec can widen that assumption without an incompatible signature change, and validated against today's fixed assumption in the meantime so a caller can never silently miscalibrate against it
bddScenarioCount - how many BDD-scenario records to generate; scaled up from the default proportionally across every represented stage, not padded
apiContractCount - how many API-contract records to generate; scaled up from the default proportionally across every represented category, not padded

public record FixtureSpec(Instant asOf, int historyStartDaysAgo, int forecastTargetDaysOut, int workingDaysPerWeek, int bddScenarioCount, int apiContractCount) extends Record
Parameters for TrackerLensFixtureGenerator: how much history to synthesize, how far out the resulting forecast should land, and how many items each of the two trackers should carry.

The same spec serves two distinct callers. A prototyping caller (e.g. the generateTrackerLensFixture Gradle task) leaves asOf() at its default of Instant.now(), so the fixture is always fresh relative to whenever it's regenerated. An automated-test caller sets asOf() explicitly (see withAsOf(Instant)), so the generator produces byte-identical output on every run regardless of what day it is. Both are the same generator and the same spec - only whether asOf() is left at its default or overridden differs.

  • Constructor Details

    • FixtureSpec

      public FixtureSpec(Instant asOf, int historyStartDaysAgo, int forecastTargetDaysOut, int workingDaysPerWeek, int bddScenarioCount, int apiContractCount)
      Validates every field.
  • Method Details

    • defaults

      public static FixtureSpec defaults()
      The default spec: asOf set to the current instant, 60 days of history, a forecast calibrated to land approximately 30 days out, a 5-day working week, 8 BDD scenarios, and 20 API contracts - immediately useful coverage, not a thin example (see TrackerLensFixtureGenerator's own Javadoc for exactly what's guaranteed).
      Returns:
      the default spec
    • withAsOf

      public FixtureSpec withAsOf(Instant newAsOf)
      Returns a copy of this spec with asOf() replaced, every other field unchanged - the usual way an automated test pins this spec to a fixed instant for byte-identical output, starting from defaults().
      Parameters:
      newAsOf - the instant to generate the fixture as of
      Returns:
      a new spec, otherwise identical to this one
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • asOf

      public Instant asOf()
      Returns the value of the asOf record component.
      Returns:
      the value of the asOf record component
    • historyStartDaysAgo

      public int historyStartDaysAgo()
      Returns the value of the historyStartDaysAgo record component.
      Returns:
      the value of the historyStartDaysAgo record component
    • forecastTargetDaysOut

      public int forecastTargetDaysOut()
      Returns the value of the forecastTargetDaysOut record component.
      Returns:
      the value of the forecastTargetDaysOut record component
    • workingDaysPerWeek

      public int workingDaysPerWeek()
      Returns the value of the workingDaysPerWeek record component.
      Returns:
      the value of the workingDaysPerWeek record component
    • bddScenarioCount

      public int bddScenarioCount()
      Returns the value of the bddScenarioCount record component.
      Returns:
      the value of the bddScenarioCount record component
    • apiContractCount

      public int apiContractCount()
      Returns the value of the apiContractCount record component.
      Returns:
      the value of the apiContractCount record component