package Ġorg . simple . clin ic . home . over due . remove patient Ċ Ċ import Ġcom . n ha ar man . mockito _ kotlin . any Ċ import Ġcom . n ha ar man . mockito _ kotlin . at Least Once Ċ import Ġcom . n ha ar man . mockito _ kotlin . in Order Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġcom . n ha ar man . mockito _ kotlin . never Ċ import Ġcom . n ha ar man . mockito _ kotlin . verify Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġio . reactivex . Comp letable Ċ import Ġio . reactivex . subjects . Publish Subject Ċ import Ġjunit params . JUnit Params Runner Ċ import Ġjunit params . Parameters Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Dead Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Invalid PhoneNumber Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Moved To Private Pract itioner Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Other Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Patient Not Resp on ding Ċ import Ġorg . simple . clin ic . over due . Appointment Cancel Reason . Transfer red To Another Public Ho spital Ċ import Ġorg . simple . clin ic . over due . Appointment Repository Ċ import Ġorg . simple . clin ic . patient . Patient Repository Ċ import Ġorg . simple . clin ic . util . Rx Errors Rule Ċ import Ġorg . simple . clin ic . widgets . Ui Event Ċ import Ġjava . util . UUID Ċ Ċ @ RunWith ( JUnit Params Runner :: class ) Ċ class ĠRemove Appointment Screen Controller Test Ġ{ ĊĊĠ Ġ@ get : Rule ĊĠ Ġval Ġrx Errors Rule Ġ= ĠRx Errors Rule () ĊĊĠ Ġprivate Ġval Ġsheet Ġ= Ġmock < Remove Appointment Screen >() ĊĠ Ġprivate Ġval Ġrepository Ġ= Ġmock < Appointment Repository >() ĊĠ Ġprivate Ġval Ġpatient Repository Ġ= Ġmock < Patient Repository >() ĊĊĠ Ġprivate Ġval Ġappointment Uuid Ġ= ĠUUID . randomUUID () ĊĠ Ġprivate Ġval Ġui Events Ġ= ĠPublish Subject . create < Ui Event >() ĊĊĠ Ġval Ġcontroller Ġ= ĠRemove Appointment Screen Controller ( repository , Ġpatient Repository ) ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġui Events . compose ( controller ). subscribe Ġ{ Ġui Change Ġ-> Ġui Change ( sheet ) Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` when Ġdone Ġis Ġclicked , Ġand Ġno Ġreason Ġis Ġselected , Ġnothing Ġshould Ġhappen `() Ġ{ ĊĠĠĠ Ġui Events . onNext ( Remove Appointment Sheet Created ( appointment Uuid )) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĊĠĠĠ Ġverify ( sheet , Ġnever ()). enable Done Button () ĊĠĠĠ Ġverify ( sheet , Ġnever ()). close Screen () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` when Ġdone Ġis Ġclicked , Ġand Ġreason Ġis Ġ" Patient Ġdead ", Ġthen Ġpatient Ġrepository Ġshould Ġbe Ġupdated `() Ġ{ ĊĠĠĠ Ġwhenever ( repository . cancel With Reason ( appointment Uuid , ĠDead )). thenReturn ( Comp letable . complete ()) ĊĠĠĠ Ġval Ġpatient Uuid Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġwhenever ( patient Repository . update Patient Status To Dead ( patient Uuid )). thenReturn ( Comp letable . complete ()) ĊĊĠĠĠ Ġui Events . onNext ( Remove Appointment Sheet Created ( appointment Uuid )) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( Patient Not Resp on ding )) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( Dead )) ĊĠĠĠ Ġui Events . onNext ( Patient Dead Clicked ( patient Uuid )) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĊĠĠĠ Ġverify ( repository , Ġnever ()). mark As Already Vis ited ( any ()) ĊĊĠĠĠ Ġval Ġin Order Ġ= Ġin Order ( sheet , Ġrepository , Ġpatient Repository ) ĊĠĠĠ Ġin Order . verify ( sheet , Ġat Least Once ()). enable Done Button () ĊĠĠĠ Ġin Order . verify ( patient Repository ). update Patient Status To Dead ( patient Uuid ) ĊĠĠĠ Ġin Order . verify ( repository ). cancel With Reason ( appointment Uuid , ĠDead ) ĊĠĠĠ Ġin Order . verify ( sheet ). close Screen () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġ@ Parameters ( method Ġ= Ġ" params Ġfor Ġcancel Ġreasons ") ĊĠ Ġfun Ġ` when Ġdone Ġis Ġclicked , Ġand Ġa Ġcancel Ġreason Ġis Ġselected , Ġthen Ġrepository Ġshould Ġupdate Ġand Ġsheet Ġshould Ġclose `( ĊĠĠĠĠĠ Ġfinally Clicked Cancel Reason : ĠAppointment Cancel Reason ĊĠ Ġ) Ġ{ ĊĠĠĠ Ġwhenever ( repository . cancel With Reason ( appointment Uuid , Ġfinally Clicked Cancel Reason )). thenReturn ( Comp letable . complete ()) ĊĊĠĠĠ Ġui Events . onNext ( Remove Appointment Sheet Created ( appointment Uuid )) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( Patient Not Resp on ding )) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( Invalid PhoneNumber )) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( Other )) ĊĠĠĠ Ġui Events . onNext ( Cancel Reason Clicked ( finally Clicked Cancel Reason )) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĊĠĠĠ Ġverify ( repository , Ġnever ()). mark As Already Vis ited ( any ()) ĊĊĠĠĠ Ġval Ġin Order Ġ= Ġin Order ( sheet , Ġrepository ) ĊĠĠĠ Ġin Order . verify ( sheet , Ġat Least Once ()). enable Done Button () ĊĠĠĠ Ġin Order . verify ( repository ). cancel With Reason ( appointment Uuid , Ġfinally Clicked Cancel Reason ) ĊĠĠĠ Ġin Order . verify ( sheet ). close Screen () ĊĠ Ġ} ĊĊĠ Ġ@ Suppress (" Unused ") ĊĠ Ġprivate Ġfun Ġ` params Ġfor Ġcancel Ġreasons ` (): ĠList < Appointment Cancel Reason > Ġ{ ĊĠĠĠ Ġreturn ĠlistOf ( ĊĠĠĠĠĠĠĠ ĠPatient Not Resp on ding , ĊĠĠĠĠĠĠĠ ĠInvalid PhoneNumber , ĊĠĠĠĠĠĠĠ ĠTrans ferred To Another Public Ho spital , ĊĠĠĠĠĠĠĠ ĠPatient Not Resp on ding , ĊĠĠĠĠĠĠĠ ĠM oved To Private Pract itioner , ĊĠĠĠĠĠĠĠ ĠOther ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` when Ġdone Ġis Ġclicked , Ġand Ġa Ġ" Patient Ġhas Ġalready Ġvisited " Ġreason Ġis Ġselected , Ġthen Ġappointment Ġshould Ġbe Ġmarked Ġas Ġvisited `() Ġ{ ĊĠĠĠ Ġwhenever ( repository . mark As Already Vis ited ( appointment Uuid )). thenReturn ( Comp letable . complete ()) ĊĊĠĠĠ Ġui Events . onNext ( Remove Appointment Sheet Created ( appointment Uuid )) ĊĠĠĠ Ġui Events . onNext ( Patient Already Vis ited Clicked ) ĊĠĠĠ Ġui Events . onNext ( Remove Reason Done Clicked ) ĊĊĠĠĠ Ġverify ( repository , Ġnever ()). cancel With Reason ( any (), Ġany ()) ĊĊĠĠĠ Ġval Ġin Order Ġ= Ġin Order ( sheet , Ġrepository ) ĊĠĠĠ Ġin Order . verify ( sheet , Ġat Least Once ()). enable Done Button () ĊĠĠĠ Ġin Order . verify ( repository ). mark As Already Vis ited ( appointment Uuid ) ĊĠĠĠ Ġin Order . verify ( sheet ). close Screen () ĊĠ Ġ} Ċ } Ċ