package Ġapp . bo let inh os . domain . bill Ċ Ċ import Ġapp . bo let inh os . domain . bill . error . B ills Is Already Paid Exception Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . isEqualTo Ċ import Ġassert k . assertions . is Failure Ċ import Ġassert k . assertions . isTrue Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . junit . Test Ċ import Ġjava . time . LocalDate Ċ Ċ class ĠPay Bill Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġgateway Ġ= ĠFake Bill Gateway () ĊĠĠĠ Ġprivate Ġval Ġvalidator Ġ= ĠBill Validator () ĊĠĠĠ Ġprivate Ġval Ġcreate Bill Ġ= ĠCreate Bill ( gateway , Ġvalidator ) ĊĠĠĠ Ġprivate Ġval Ġpay Bill Ġ= ĠPay Bill ( gateway ) ĊĊĠĠĠ Ġprivate Ġval Ġfake Bill Ġ= ĠBill ( ĊĠĠĠĠĠĠĠ Ġname Ġ= Ġ" Personal Ġexpense ", ĊĠĠĠĠĠĠĠ Ġdescription Ġ= Ġ" Food ĠCategory ", ĊĠĠĠĠĠĠĠ Ġvalue Ġ= Ġ 2 5 0 _ 0 0 L , ĊĠĠĠĠĠĠĠ Ġpayment Date Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġdue Date Ġ= ĠLocalDate . now (), ĊĠĠĠĠĠĠĠ Ġstatus Ġ= ĠBill Status . UN PA ID ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` should Ġmark Ġbill Ġas Ġpaid `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbill Ġ= Ġfake Bill ĊĠĠĠĠĠĠĠ Ġbill . id Ġ= Ġ 1 0 0 ĊĊĠĠĠĠĠĠĠ Ġcreate Bill ( bill ) ĊĠĠĠĠĠĠĠ Ġpay Bill ( bill ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= Ġgateway . b ills . getValue ( 1 0 0 ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( actual . status ). isEqualTo ( Bill Status . PA ID ) ĊĠĠĠĠĠĠĠ ĠassertThat ( actual . is Paid ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` should Ġthrow Ġexception Ġif Ġtry Ġto Ġpay Ġa Ġpaid Ġbill `() Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbill Ġ= Ġfake Bill . copy ( payment Date Ġ= ĠLocalDate . now ()) ĊĠĠĠĠĠĠĠ Ġbill . id Ġ= Ġ 1 0 0 ĊĊĠĠĠĠĠĠĠ ĠassertThat Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcreate Bill ( bill ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpay Bill ( bill ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpay Bill ( bill ) ĊĠĠĠĠĠĠĠ Ġ}. is Failure (). isEqualTo ( B ills Is Already Paid Exception ) ĊĠĠĠ Ġ} Ċ } Ċ