package Ġorg . simple . clin ic . over due . communication Ċ Ċ import Ġandroid . support . test . runner . Android JUnit 4 Ċ 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 . junit . runner . RunWith Ċ import Ġorg . simple . clin ic . Authentication Rule Ċ import Ġorg . simple . clin ic . Test Clin ic App Ċ import Ġorg . simple . clin ic . TestData Ċ import Ġorg . simple . clin ic . patient . Sync Status Ċ import Ġorg . simple . clin ic . user . User Session Ċ import Ġorg . simple . clin ic . util . Rx Errors Rule Ċ import Ġjava . util . UUID Ċ import Ġjavax . inject . Inject Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠCommunication Repository Android Test Ġ{ ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġrepository : ĠCommunication Repository ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġuser Session : ĠUser Session ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar ĠtestData : ĠTest Data ĊĊĠ Ġprivate Ġval Ġauthentication Rule Ġ= ĠAuthentication Rule () ĊĊĠ Ġprivate Ġval Ġrx Errors Rule Ġ= ĠRx Errors Rule () ĊĊĠ Ġ@ get : Rule ĊĠ Ġval Ġrule Chain Ġ= ĠRule Chain ĊĠĠĠĠĠ Ġ. outer Rule ( authentication Rule ) ĊĠĠĠĠĠ Ġ. around ( rx Errors Rule ) !! ĊĊĠ Ġ@ Before ĊĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠ ĠTest Clin ic App . app Component (). inject ( this ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġwhen _ creating _ new _ communication _ then _ the _ communication _ should _ be _ saved () Ġ{ ĊĠĠĠ Ġval Ġappointment Id Ġ= ĠUUID . randomUUID () ĊĊĠĠĠ Ġrepository ĊĠĠĠĠĠĠĠ Ġ. create ( appointment Id , ĠCommunication . Type . MAN UAL _ CALL , Ġresult Ġ= ĠCommunication . Result . UN AVAILABLE ) ĊĠĠĠĠĠĠĠ Ġ. blocking Await () ĊĊĠĠĠ Ġval Ġsaved Communication Ġ= Ġrepository . record sWith Sync Status ( Sync Status . PENDING ). blocking Get ()[ 0 ] ĊĠĠĠ Ġsaved Communication . apply Ġ{ ĊĠĠĠĠĠ ĠassertThat ( this . appointment Uuid ). isEqualTo ( appointment Id ) ĊĠĠĠĠĠ ĠassertThat ( this . type ). isEqualTo ( Communication . Type . MAN UAL _ CALL ) ĊĠĠĠĠĠ ĠassertThat ( this . result ). isEqualTo ( Communication . Result . UN AVAILABLE ) ĊĠĠĠĠĠ ĠassertThat ( this . sync Status ). isEqualTo ( Sync Status . PENDING ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ