package Ġcom . template Ċ Ċ import Ġcom . template . flows . Create Flow Ċ import Ġnet . cord a . testing . node .* Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġcom . template . states . Template State Ċ import Ġjava . util . concurrent . Future ; Ċ import Ġnet . cord a . core . node . services . vault . Query Criteria Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġcom . template . flows . Init iator Ċ import Ġcom . template . model . Status Ċ import Ġcom . template . states . Re ins urance State Ċ import Ġnet . cord a . core . contracts . Unique Identifier Ċ import Ġnet . cord a . core . identity . Abstract Party Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . node . services . Vault . State Status ĊĊ Ċ class ĠAppro ve Flow Test Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnetwork : ĠMock Network ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġissuer : ĠStarted Mock Node ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġre ins urer : ĠStarted Mock Node ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġregister : ĠStarted Mock Node ĊĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġnetwork Ġ= ĠMock Network ( Mock Network Parameters ( cord apps ForAll Nodes Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . template . contracts "), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . template . flows ") ĊĠĠĠĠĠĠĠ Ġ))) ĊĠĠĠĠĠĠĠ Ġissuer Ġ= Ġnetwork . create Party Node () ĊĠĠĠĠĠĠĠ Ġre ins urer Ġ= Ġnetwork . create Party Node () ĊĠĠĠĠĠĠĠ Ġregister Ġ= Ġnetwork . create Party Node () ĊĠĠĠĠĠĠĠ Ġnetwork . run Network () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ Ġnetwork . stop Nodes () ĊĠĠĠ Ġ} ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` approve Ġa Ġstate `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontract Id : String Ġ= Ġ" 1 2 3 4 " ĊĠĠĠĠĠĠĠ Ġval Ġre ins ur ace State Ġ= ĠRe ins urance State ( contract Id , issuer . info . legal Id entities . first (), Ġre ins urer . info . legal Id entities . first (), Ġregister . info . legal Id entities . first (), Status . WAIT ING _ APPRO VAL ) ĊĠĠĠĠĠĠĠ Ġval Ġflow Ġ= ĠCreate Flow ( re ins urer . info . legal Id entities . first (), Ġregister . info . legal Id entities . first (), Ġcontract Id Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfuture : ĠFuture < Signed Transaction > Ġ= Ġissuer . start Flow ( flow ) ĊĠĠĠĠĠĠĠ Ġnetwork . run Network () ĊĊĠĠĠĠĠĠĠ Ġ// successful Ġquery Ġmeans Ġthe Ġstate Ġis Ġstored Ġat Ġnode Ġb 's Ġvault . ĠFlow Ġwent Ġthrough . ĊĠĠĠĠĠĠĠ Ġval Ġinput Criteria : ĠQuery Criteria Ġ= ĠQuery Criteria . Vault Query Criteria (). with Status ( State Status . UN CON SU MED ) ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= Ġissuer . services . vault Service . query By ( Re ins urance State :: class . java , Ġinput Criteria ). states [ 0 ]. state . data ĊĠĠĠ Ġ} Ċ }