package Ġon ion soup . loan application Ċ Ċ import Ġarrow . core . Option Ċ import Ġarrow . core . some Ċ import Ġarrow . fx . IO Ċ import Ġcore . extensions . utc Now Ċ import Ġio . kot est . assertions . arrow . either . shouldBe Left Ċ import Ġio . kot est . assertions . arrow . either . shouldBe Right Ċ import Ġio . kot est . core . spec . style . Fun Spec Ċ import Ġon ion soup . loan application . Loan Application Draft Fixtures . loan Application Ċ import Ġjava . time . Clock Ċ import Ġjava . time . Instant Ċ import Ġjava . time . Zone Id Ċ Ċ class ĠSubmit Loan Application Draft UseCase Spec Ġ: ĠFun Spec ({ ĊĠ Ġval Ġclock Ġ= ĠClock . fixed ( Instant . now (), ĠZone Id . of (" UTC ")) ĊĠ Ġcontext (" Submit Loan Application Draft UseCase ") Ġ{ ĊĠĠĠ Ġtest (" submit Ġinvalid Ġdraft ") Ġ{ ĊĠĠĠĠĠ Ġval Ġuse Case Ġ= Ġsubmit Loan Application Draft ( ĊĠĠĠĠĠĠĠ Ġclock Ġ= Ġclock , ĊĠĠĠĠĠĠĠ Ġfind Loan Draft Draft Ġ= Ġ{ ĠIO . just ( Loan Application Draft . new Draft ( it , Ġ" test 2 "). some ()) Ġ}, ĊĠĠĠĠĠĠĠ Ġmark Draft As Submitted Ġ= ĠLo an Application Draft Fixtures . no Op Model Updater () ĊĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġuse Case ( Submit Loan Application Command (" 1 2 ", ĠOperator Handle (" op "), Ġ" rid ")). unsafe Run Sync () ĠshouldBe Left ĠSubmit Loan Application Error . Draft Is Invalid ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtest (" submit Ġvalid Ġloan Ġdraft ") Ġ{ ĊĠĠĠĠĠ Ġval Ġuse Case Ġ= ĊĠĠĠĠĠĠĠ Ġsubmit Loan Application Draft ( ĊĠĠĠĠĠĠĠĠĠ Ġclock Ġ= Ġclock , ĊĠĠĠĠĠĠĠĠĠ Ġfind Loan Draft Draft Ġ= Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIO . just ( Loan Application Draft Fixtures . complete Loan Application Draft ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. copy ( id Ġ= Ġit ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. some ()) ĊĠĠĠĠĠĠĠĠĠ Ġ}, ĊĠĠĠĠĠĠĠĠĠ Ġmark Draft As Submitted Ġ= ĠLo an Application Draft Fixtures . no Op Model Updater () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġuse Case ( Submit Loan Application Command (" 1 2 ", ĠOperator Handle (" op "), " rid ")). unsafe Run Sync () ĠshouldBe Right ĠLo an Application Submitted ( ĊĠĠĠĠĠĠĠ Ġloan Ġ= ĠLo an Application Draft Fixtures . loan Application . loan , ĊĠĠĠĠĠĠĠ Ġoccurred At Ġ= Ġclock . utc Now (), ĊĠĠĠĠĠĠĠ Ġproperty Ġ= Ġloan Application . property , ĊĠĠĠĠĠĠĠ Ġcustomer Ġ= Ġloan Application . customer , ĊĠĠĠĠĠĠĠ Ġaggregate Id Ġ= Ġ" 1 2 ", ĊĠĠĠĠĠĠĠ Ġoperator Ġ= ĠOperator Handle (" op ") ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtest (" submit Ġnon Ġexisting Ġ Ġloan Ġdraft ") Ġ{ ĊĠĠĠĠĠ Ġval Ġuse Case Ġ= ĊĠĠĠĠĠĠĠ Ġsubmit Loan Application Draft ( ĊĠĠĠĠĠĠĠĠĠ Ġclock Ġ= Ġclock , ĊĠĠĠĠĠĠĠĠĠ Ġfind Loan Draft Draft Ġ= Ġ{ ĠIO . just ( Option . empty ()) Ġ}, ĊĠĠĠĠĠĠĠĠĠ Ġmark Draft As Submitted Ġ= ĠLo an Application Draft Fixtures . no Op Model Updater () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġuse Case ( Submit Loan Application Command (" 1 2 ", ĠOperator Handle (" op "), " rid ")). unsafe Run Sync () ĠshouldBe Left ĠSubmit Loan Application Error . Draft NotFound ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }) Ċ