package Ġorg . simple . clin ic . summary . add phone Ċ Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Rule Chain Ċ import Ġorg . simple . clin ic . Test Clin ic App Ċ import Ġorg . simple . clin ic . rules . Save Database Rule Ċ import Ġorg . simple . shared Test Code . util . Rules Ċ import Ġorg . simple . clin ic . util . Utc Clock Ċ import Ġjava . time . Instant Ċ import Ġjava . util . UUID Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠMissing Phone Reminder Repository Android Test Ġ{ ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġrepository : ĠMissing Phone Reminder Repository ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġdao : ĠMissing Phone Reminder . Room Dao ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġclock : ĠU tc Clock ĊĊĠ Ġ@ get : Rule ĊĠ Ġval Ġrule Chain : ĠRule Chain Ġ= ĠRules ĊĠĠĠĠĠ Ġ. global () ĊĠĠĠĠĠ Ġ. around ( Save Database Rule ()) ĊĊĠ Ġprivate Ġval Ġpatient Uuid Ġ= ĠUUID . randomUUID () ĊĊĠ Ġ@ Before ĊĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠ ĠTest Clin ic App . app Component (). inject ( this ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġsaving _ a _ reminder _ should _ work () Ġ{ ĊĠĠĠ Ġval Ġre min ded At Ġ= ĠInstant . now ( clock ) ĊĠĠĠ Ġrepository . mark Reminder As Shown For ( patient Uuid ). blocking Await () ĊĊĠĠĠ Ġval Ġsaved Reminder Ġ= Ġdao . get ( patient Uuid ). blocking First (). first () ĊĠĠĠ ĠassertThat ( saved Reminder ). isEqualTo ( Missing Phone Reminder ( patient Uuid , Ġre min ded At )) ĊĠ Ġ} ĊĊĠ Ġ@ Suppress (" Local Variable Name ", Ġ" Illegal Identifier ") ĊĠ Ġ@ Test ĊĠ Ġfun Ġwhen _ a _ missing _ phone _ reminder _ is _ present _ for _ a _ patient _ then _ checking _ w hether _ a _ reminder _ has _ been _ shown _ should _ return _ true () Ġ{ ĊĠĠĠ Ġ// Ġgiven ĊĠĠĠ Ġval Ġ` patient Ġwho Ġhas Ġbeen Ġshown Ġreminder ` Ġ= ĠUUID . fromString (" b 9 eac 2 9 6 - 9 b 1 2 - 4 6 0 1 - 8 4 6 2 - e 0 7 b 5 3 3 8 acd 3 ") ĊĊĠĠĠ Ġrepository . mark Reminder As Shown For (` patient Ġwho Ġhas Ġbeen Ġshown Ġreminder `). blocking Await () ĊĊĠĠĠ Ġ// Ġwhen ĊĠĠĠ Ġval Ġhas AS aved Reminder Ġ= Ġrepository . has Shown Reminder For Patient (` patient Ġwho Ġhas Ġbeen Ġshown Ġreminder `) ĊĊĠĠĠ Ġ// Ġthen ĊĠĠĠ ĠassertThat ( has AS aved Reminder ). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Suppress (" Local Variable Name ", Ġ" Illegal Identifier ") ĊĠ Ġ@ Test ĊĠ Ġfun Ġwhen _ a _ missing _ phone _ reminder _ is _ not _ present _ for _ a _ patient _ then _ checking _ w hether _ a _ reminder _ has _ been _ shown _ should _ return _ false () Ġ{ ĊĠĠĠ Ġ// given ĊĠĠĠ Ġval Ġ` patient Ġwho Ġhas Ġbeen Ġshown Ġreminder ` Ġ= ĠUUID . fromString (" b 9 eac 2 9 6 - 9 b 1 2 - 4 6 0 1 - 8 4 6 2 - e 0 7 b 5 3 3 8 acd 3 ") ĊĠĠĠ Ġval Ġ` patient Ġwho Ġhas Ġnot Ġbeen Ġshown Ġreminder ` Ġ= ĠUUID . fromString (" d 0 4 1 4 d 6 d - 9 8 1 3 - 4 d 8 5 - ad 6 1 - 6 3 4 f 7 cdd ab 7 6 ") ĊĊĠĠĠ Ġrepository . mark Reminder As Shown For (` patient Ġwho Ġhas Ġbeen Ġshown Ġreminder `). blocking Await () ĊĊĠĠĠ Ġ// Ġwhen ĊĠĠĠ Ġval Ġhas AS aved Reminder Ġ= Ġrepository . has Shown Reminder For Patient (` patient Ġwho Ġhas Ġnot Ġbeen Ġshown Ġreminder `) ĊĊĠĠĠ Ġ// Ġthen ĊĠĠĠ ĠassertThat ( has AS aved Reminder ). isFalse () ĊĠ Ġ} Ċ } Ċ