@ file : Suppress (" unused ") Ċ package Ġio . hol ix on . ax on . testing . j given . saga Ċ Ċ import Ġcom . t ng tech . j given . Stage Ċ import Ġcom . t ng tech . j given . annotation . As Ċ import Ġcom . t ng tech . j given . annotation . Expected Scenario State Ċ import Ġcom . t ng tech . j given . annotation . Provided Scenario State Ċ import Ġcom . t ng tech . j given . annotation . Quoted Ċ import Ġio . hol ix on . ax on . testing . j given . Ax on J Given Stage Ċ import Ġorg . ax on framework . test . saga . Fixture Execution Result Ċ import Ġorg . ax on framework . test . saga . When State Ċ import Ġjava . time . Duration Ċ import Ġjava . time . Instant ĊĊ Ċ /** Ċ Ġ* ĠWhen Ġstage Ġfor Ġs aga Ġfixture . Ċ Ġ* Ġ@ param ĠT Ġaggregate Ġtype . Ċ Ġ*/ Ċ @ Ax on J Given Stage Ċ class ĠS aga Fixture When < T > Ġ: ĠStage < Saga Fixture When < T >>() Ġ{ ĊĊĠ Ġ@ Expected Scenario State ( required Ġ= Ġtrue ) ĊĠ Ġlateinit Ġvar Ġwhen State : ĠWhen State ĊĊĠ Ġ@ Provided Scenario State ĊĠ Ġlateinit Ġvar Ġthen State : ĠFix ture Execution Result ĊĊĠ Ġ@ As (" when Ġaggregate Ġ$ Ġpub lishes Ġevent : Ġ$ ") ĊĠ Ġfun Ġaggregate Pub lishes (@ Quoted Ġaggregate Identifier : ĠString , Ġevent : ĠAny ): ĠS aga Fixture When < T > Ġ= Ġexecute Ġ{ ĊĠĠĠ Ġwhen State . when Aggregate ( aggregate Identifier ). pub lishes ( event ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠTime Ġadv ances . ĊĠĠ Ġ* Ġ@ param Ġinstant Ġnew Ġtime Ġto Ġset . ĊĠĠ Ġ*/ ĊĠ Ġfun Ġtime Adv ances To ( instant : ĠInstant ) Ġ= Ġexecute Ġ{ ĊĠĠĠ Ġwhen State . when Time Adv ances To ( instant ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠTime Ġadv ances . ĊĠĠ Ġ* Ġ@ param Ġduration Ġduration Ġto Ġset Ġtime Ġto . ĊĠĠ Ġ*/ ĊĠ Ġfun Ġtime E lap ses ( duration : ĠDuration ) Ġ= Ġexecute Ġ{ ĊĠĠĠ Ġwhen State . when Time E lap ses ( duration ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠApplication Ġhas Ġpublished Ġan Ġevent . ĊĠĠ Ġ* Ġ@ param Ġevent Ġevent Ġpublished Ġby Ġthe Ġapplication ĊĠĠ Ġ*/ ĊĠ Ġfun Ġpublishing ( event : ĠAny ): ĠS aga Fixture When < T > Ġ= Ġexecute Ġ{ ĊĠĠĠ Ġwhen State . when Publishing A ( event ) ĊĠ Ġ} ĊĊĊĠ Ġprivate Ġfun Ġexecute ( block : Ġ() Ġ-> ĠFix ture Execution Result ) Ġ= Ġself (). apply Ġ{ ĊĠĠĠ Ġthen State Ġ= Ġblock . invoke () ĊĠ Ġ} !! Ċ Ċ } Ċ