The line/job impls

For every line/job combination that requires testing, there is an impl whose name is <Line><Job>ContextImpl. This impl combines methods from the appropriate line of business layer and the appropriate job layer. For example, the following diagram depicts an example of PAPolicyChangeContextImpl. This impl combines methods from the line-specific PAContext and the job-specific PolicyChangeImpl.


A line/job-specific impl.

Like Java, Gosu does not support multiple inheritance. To create a <Line><Job>ContextImpl class (such as PAPolicyChangeContextImpl) that inherits information from multiple, non-related parent classes:

  • The job dimension is considered the "primary" dimension. The <Line><Job>ContextImpl extends the appropriate <Job>ContextImplBase class and inherits its methods.
    • For example, PAPolicyChangeContextImpl extends PolicyChangeContextImplBase.
  • The methods from the appropriate <Line>ContextImpl are made available to the <Line><Job>ContextImpl class through the use of a delegate named _lineContextDelegate.
    • For example, the methods from PAContextImpl are made available to PAPolicyChangeContextImpl through the use of a delegate named _lineContextDelegate.

This multi-layered structure provides flexibility so that testing logic can be implemented in a way that matches the needs of each line of business and each job.

  • Logic that is identical across all lines of business and jobs is implemented in either in LineContext and its impl or in JobContext and its impl. For example:
    • addLineLevelCoverages is implemented in LineContextImplBase.
    • setEffectiveDate is implemented in JobContextImplBase.
  • Logic that is LOB-specific (but the same for all jobs) is declared in <Line>Context and its impl. For example:
    • addDriver is implemented in PAContextImpl.
  • Logic that is job-specific (but the same for all LOBS) is declared in <Job>Context and its impl. For example:
    • applyPreemptionChanges is implemented in PolicyChangeContextImpl.
  • Logic that is LOB-specific and job-specific is declared in <Line><Job>Context and its impl. For example:
    • verifyVehicleExists is implemented in PAPolicyChangeContextImpl.