package Ġcom . template . flows Ċ Ċ import Ġcom . r 3 . cord a . lib . tokens . contracts . states . F ung ible Token Ċ import Ġcom . r 3 . cord a . lib . tokens . money . USD Ċ import Ġcom . template . states . Coin State Ċ import Ġnet . cord a . core . contracts . Transaction Verification Exception Ċ import Ġnet . cord a . core . utilities . get OrThrow Ċ import Ġnet . cord a . testing . common . internal . test Network Parameters Ċ import Ġnet . cord a . testing . core . single Identity Ċ import Ġnet . cord a . testing . node . Mock Network Ċ import Ġnet . cord a . testing . node . Mock Network Parameters Ċ import Ġnet . cord a . testing . node . Started Mock Node Ċ import Ġnet . cord a . testing . node . Test C ord app Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assert Fails With Ċ import Ġkotlin . test . assertNotNull Ċ Ċ class ĠFlow Tests Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnetwork : ĠMock Network ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġa : ĠStarted Mock Node ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġb : Ġ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 . states "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . template . flows "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . template . contracts "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . r 3 . cord a . lib . tokens . contracts "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTest C ord app . find C ord app (" com . r 3 . cord a . lib . tokens . workflows ")), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthread Per Node Ġ= Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnetwork Parameters Ġ= Ġtest Network Parameters ( minimum Platform Version Ġ= Ġ 4 ) ĊĠĠĠĠĠĠĠ Ġ)) ĊĠĠĠĠĠĠĠ Ġa Ġ= Ġnetwork . create Party Node () ĊĠĠĠĠĠĠĠ Ġb Ġ= Ġnetwork . create Party Node () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ= Ġnetwork . stop Nodes () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Money Are Iss ued To Re ce pi ent `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġborrow er Ġ= Ġb . info . single Identity () ĊĊĠĠĠĠĠĠĠ Ġa . start Flow ( Issue Fi at Currency Flow ( USD . token Identifier , Ġ 1 0 0 , Ġborrow er )). get OrThrow () ĊĠĠĠĠĠĠĠ Ġnetwork . wait Qu ies cent () ĊĠĠĠĠĠĠĠ Ġval Ġbalance Ġ= Ġb . services . vault Service . query By ( F ung ible Token :: class . java ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( balance . states [ 0 ]. state . data . amount . quantity , Ġ 1 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Coin Token Is Created And Iss ued To Holder `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġholder Ġ= Ġb . info . single Identity () ĊĊĠĠĠĠĠĠĠ Ġa . start Flow ( Create And Issue Local Coin Flow (" ETH "," USD ", Ġ 1 0 0 Ġ, Ġ 1 0 0 0 0 , Ġholder )). get OrThrow () ĊĠĠĠĠĠĠĠ Ġnetwork . wait Qu ies cent () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( b . services . vault Service . query By ( Coin State :: class . java )) ĊĊĠĠĠĠĠĠĠ Ġval Ġbalance Ġ= Ġb . services . vault Service . query By ( F ung ible Token :: class . java ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( balance . states [ 0 ]. state . data . amount . quantity , Ġ 1 0 0 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Coin Token _ without _ proper _ inputs _ fails `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġholder Ġ= Ġb . info . single Identity () ĊĊĠĠĠĠĠĠĠ Ġval Ġfuture _ no _ name Ġ= Ġa . start Flow ( Create And Issue Local Coin Flow ("", Ġ" USD ", Ġ 1 0 0 , Ġ 1 0 0 0 0 , Ġholder )) ĊĠĠĠĠĠĠĠ Ġnetwork . wait Qu ies cent () ĊĠĠĠĠĠĠĠ Ġassert Fails With < Transaction Verification Exception > Ġ{ Ġfuture _ no _ name . get OrThrow () Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġfuture _ price _ zero Ġ= Ġa . start Flow ( Create And Issue Local Coin Flow (" ETH ", Ġ"", Ġ 1 0 0 , Ġ 0 , Ġholder )) ĊĠĠĠĠĠĠĠ Ġnetwork . wait Qu ies cent () ĊĠĠĠĠĠĠĠ Ġassert Fails With < Transaction Verification Exception > Ġ{ Ġfuture _ price _ zero . get OrThrow () Ġ} ĊĠĠĠ Ġ} Ċ }