package Ġorg . simple . clin ic . summary . pre scribed drug s Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Return Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify No More Interactions Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġdagger . Lazy Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . rx kotlin . of Type Ċ import Ġio . reactivex . subjects . Publish Subject Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Test Ċ import Ġorg . simple . clin ic . TestData Ċ import Ġorg . simple . clin ic . drug s . Pre scribed Dr ug Ċ import Ġorg . simple . clin ic . drug s . Pre scription Repository Ċ import Ġorg . simple . clin ic . util . scheduler . Test Schedulers Provider Ċ import Ġorg . simple . clin ic . widgets . Ui Event Ċ import Ġorg . simple . mob ius . migration . Mob ius TestFixture Ċ import Ġjava . util . UUID Ċ Ċ class ĠDr ug Summary Ui Logic Test Ġ{ ĊĊĠ Ġprivate Ġval Ġpatient Uuid Ġ= ĠUUID . fromString (" f 5 df ca 0 5 - 5 9 da - 4 b 9 1 - 9 7 4 3 - 8 4 d 2 6 9 0 8 4 4 c 1 ") ĊĊĠ Ġprivate Ġval Ġui Ġ= Ġmock < Dr ug Summary Ui >() ĊĠ Ġprivate Ġval Ġui Actions Ġ= Ġmock < Dr ug Summary Ui Actions >() ĊĠ Ġprivate Ġval Ġrepository Ġ= Ġmock < Pre scription Repository >() ĊĠ Ġprivate Ġval Ġevents Ġ= ĠPublish Subject . create < Ui Event >() ĊĊĠ Ġprivate Ġval Ġcurrent Facility Ġ= ĠTest Data . facility ( UUID . fromString (" af 8 e 8 1 7 c - 8 7 7 2 - 4 c 8 4 - 9 f 4 f - 1 f 3 3 1 fa 0 b 2 a 5 ")) ĊĊĠ Ġprivate Ġlateinit Ġvar Ġtest Fixture : ĠMob ius TestFixture < Dr ug Summary Model , ĠDr ug Summary Event , ĠDr ug Summary Effect > ĊĊĠ Ġ@ After ĊĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠ Ġtest Fixture . dispose () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` patient 's Ġpre scription Ġsummary Ġshould Ġbe Ġpopulated `() Ġ{ ĊĠĠĠ Ġ// Ġgiven ĊĠĠĠ Ġval Ġpre scriptions Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ ĠTest Data . pre scription ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuuid Ġ= ĠUUID . fromString (" b 9 9 c 1 4 7 c - d 2 db - 4 b 7 3 - 9 b 8 e - cf 8 8 6 6 b 7 daa 1 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġ" Am lo dip ine ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdos age Ġ= Ġ" 1 0 mg " ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ ĠTest Data . pre scription ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuuid Ġ= ĠUUID . fromString (" 2 6 2 7 5 2 e 2 - 1 5 6 5 - 4 1 4 0 - 9 8 d 8 - 0 b 1 e 9 1 4 dbb 6 4 "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġ" Tel mis art an ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdos age Ġ= Ġ" 9 0 0 0 mg " ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ ĠTest Data . pre scription ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuuid Ġ= ĠUUID . fromString (" f 0 6 7 4 dbd - 6 9 8 1 - 4 b 7 9 - ae 3 c - 8 b 5 1 3 ba 1 1 6 6 c "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġ" Random z ole ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdos age Ġ= Ġ" 2 Ġpackets " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġwhenever ( repository . new est Pre scriptions For Patient ( patient Uuid )) Ġdo Return ĠObservable . just ( pre scriptions ) ĊĊĠĠĠ Ġ// Ġwhen ĊĠĠĠ Ġsetup Controller () ĊĊĠĠĠ Ġ// Ġthen ĊĠĠĠ Ġverify ( ui ). populate Pre scribed Dr ug s ( pre scriptions ) ĊĠĠĠ Ġverify No More Interactions ( ui , Ġui Actions ) ĊĊĠĠĠ Ġverify ( repository ). new est Pre scriptions For Patient ( patient Uuid ) ĊĠĠĠ Ġverify No More Interactions ( repository ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` when Ġupdate Ġmedic ines Ġis Ġclicked Ġthen Ġupdated Ġpre scription Ġscreen Ġshould Ġbe Ġshown `() Ġ{ ĊĠĠĠ Ġ// Ġgiven ĊĠĠĠ Ġval Ġlogged In User Ġ= ĠTest Data . logged In User ( UUID . fromString (" e 8 3 b 9 b 2 7 - 0 a 0 5 - 4 7 5 0 - 9 ef 7 - 2 7 0 cda 6 5 2 1 7 b ")) ĊĊĠĠĠ Ġwhenever ( repository . new est Pre scriptions For Patient ( patient Uuid )) Ġdo Return ĠObservable . never < List < Pre scribed Dr ug >>() ĊĊĠĠĠ Ġ// Ġwhen ĊĠĠĠ Ġsetup Controller () ĊĠĠĠ Ġevents . onNext ( Patient Summary Update Dr ug s Clicked ()) ĊĊĠĠĠ Ġ// Ġthen ĊĠĠĠ Ġverify ( ui Actions ). show Update Pre scribed Dr ug s Screen ( patient Uuid , Ġcurrent Facility ) ĊĠĠĠ Ġverify No More Interactions ( ui , Ġui Actions ) ĊĊĠĠĠ Ġverify ( repository ). new est Pre scriptions For Patient ( patient Uuid ) ĊĠĠĠ Ġverify No More Interactions ( repository ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Controller () Ġ{ ĊĠĠĠ Ġval Ġeffect Handler Ġ= ĠDr ug Summary Effect Handler ( ĊĠĠĠĠĠĠĠ Ġpre scription Repository Ġ= Ġrepository , ĊĠĠĠĠĠĠĠ Ġcurrent Facility Ġ= ĠLazy Ġ{ Ġcurrent Facility Ġ}, ĊĠĠĠĠĠĠĠ Ġs chedulers Provider Ġ= ĠTest Schedulers Provider . tr amp oline (), ĊĠĠĠĠĠĠĠ Ġui Actions Ġ= Ġui Actions ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġui Renderer Ġ= ĠDr ug Summary Ui Renderer ( ui ) ĊĊĠĠĠ Ġtest Fixture Ġ= ĠMob ius TestFixture ( ĊĠĠĠĠĠĠĠ Ġevents Ġ= Ġevents . of Type (), ĊĠĠĠĠĠĠĠ Ġdefault Model Ġ= ĠDr ug Summary Model . create ( patient Uuid ), ĊĠĠĠĠĠĠĠ Ġinit Ġ= ĠDr ug Summary Init (), ĊĠĠĠĠĠĠĠ Ġupdate Ġ= ĠDr ug Summary Update (), ĊĠĠĠĠĠĠĠ Ġeffect Handler Ġ= Ġeffect Handler . build (), ĊĠĠĠĠĠĠĠ Ġmodel Update Listener Ġ= Ġui Renderer :: render ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġtest Fixture . start () ĊĠ Ġ} Ċ } Ċ