package Ġuk . n hs . n hs x . covid 1 9 . android . app . ex posure . share keys Ċ Ċ import Ġandroid . app . Activity . RESULT _ C ANCE LED Ċ import Ġandroid . app . Activity . RESULT _ OK Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġio . mock k . confirm Verified Ċ import Ġio . mock k . every Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . verify Ċ import Ġio . mock k . verify Order Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġuk . n hs . n hs x . covid 1 9 . android . app . ex posure . share keys . Share Keys Navigate To . Share Keys Result Activity Ċ import Ġuk . n hs . n hs x . covid 1 9 . android . app . remote . data . V iro logy Test Kit Type . LAB _ RESULT Ċ import Ġjava . time . Clock Ċ import Ġjava . time . Instant Ċ import Ġjava . time . Zone Offset Ċ Ċ class ĠShare Keys Information ViewModel Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġinstant Task Executor Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġprivate Ġval Ġsubmit Ep ide mio logy Data For TestResult Ġ= Ġmock k < Submit Ep ide mio logy Data For TestResult >( relax Unit Fun Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġfetch Keys Flow Factory Ġ= Ġmock k < Fetch Keys Flow . Factory >() ĊĠĠĠ Ġprivate Ġval Ġfetch Keys Flow Ġ= Ġmock k < Fetch Keys Flow >( relax Unit Fun Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġkey Sharing Info Provider Ġ= Ġmock k < Key Sharing Info Provider >( relax Unit Fun Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġfixed Clock Ġ= ĠClock . fixed ( Instant . parse (" 2 0 2 0 - 0 7 - 2 8 T 0 0 : 0 5 : 0 0 . 0 0 Z "), ĠZone Offset . UTC ) ĊĊĠĠĠ Ġprivate Ġval Ġkey Sharing Info Ġ= ĠKey Sharing Info ( ĊĠĠĠĠĠĠĠ Ġdi agnosis Key Submission Token Ġ= Ġ" token 1 ", ĊĠĠĠĠĠĠĠ Ġacknowled ged Date Ġ= ĠInstant . parse (" 2 0 2 0 - 0 7 - 1 0 T 0 1 : 0 0 : 0 0 . 0 0 Z "), ĊĠĠĠĠĠĠĠ Ġnotification Sent Date Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġtest Kit Type Ġ= ĠLAB _ RESULT , ĊĠĠĠĠĠĠĠ Ġrequires Conf ir mat ory Test Ġ= Ġfalse ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġval Ġtest Subject Ġ= ĠShare Keys Information ViewModel ( ĊĠĠĠĠĠĠĠ Ġsubmit Ep ide mio logy Data For TestResult , ĊĠĠĠĠĠĠĠ Ġfetch Keys Flow Factory , ĊĠĠĠĠĠĠĠ Ġkey Sharing Info Provider , ĊĠĠĠĠĠĠĠ Ġfixed Clock ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġval Ġnavigation Observer Ġ= Ġmock k < Observer < Share Keys Navigation Target >>( relax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġkey Sharing Info Provider . key Sharing Info Ġ} Ġreturns Ġkey Sharing Info ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġfetch Keys Flow Factory . create ( any (), Ġany (), Ġany ()) Ġ} Ġreturns Ġfetch Keys Flow ĊĠĠĠĠĠĠĠ Ġtest Subject . navigation (). observe Fore ver ( navigation Observer ) ĊĠĠĠĠĠĠĠ Ġtest Subject . onCreate () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` when Ġuser Ġch oo ses Ġto Ġsubmit Ġkeys Ġthen Ġfetch Ġkeys Ġflow Ġis Ġcalled `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtest Subject . on Share Keys Button Clicked () ĊĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġfetch Keys Flow () Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġwhen Ġrequest Ġcode Ġdoes Ġnot Ġindicate Ġsuccessful Ġkey Ġsubmission `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġunexpected Request Code Ġ= Ġ 1 2 3 4 ĊĊĠĠĠĠĠĠĠ Ġtest Subject . on Activity Result ( unexpected Request Code , ĠRESULT _ OK ) ĊĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġfetch Keys Flow . on Activity Result ( unexpected Request Code , ĠRESULT _ OK ) Ġ} ĊĊĠĠĠĠĠĠĠ Ġconfirm Verified ( fetch Keys Flow , Ġsubmit Ep ide mio logy Data For TestResult , Ġnavigation Observer ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġafter Ġkey Ġsubmission Ġwith Ġresult Ġcanceled `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtest Subject . on Activity Result ( Share Keys Information Activity . REQUEST _ CODE _ SUBMIT _ KEYS , ĠRESULT _ C ANCE LED ) ĊĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfetch Keys Flow . on Activity Result ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠShare Keys Information Activity . REQUEST _ CODE _ SUBMIT _ KEYS , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRESULT _ C ANCE LED ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġconfirm Verified ( fetch Keys Flow , Ġsubmit Ep ide mio logy Data For TestResult , Ġnavigation Observer ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġafter Ġsuccessful Ġkey Ġsubmission `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtest Subject . on Activity Result ( Share Keys Information Activity . REQUEST _ CODE _ SUBMIT _ KEYS , ĠRESULT _ OK ) ĊĊĠĠĠĠĠĠĠ Ġverify Order Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfetch Keys Flow . on Activity Result ( Share Keys Information Activity . REQUEST _ CODE _ SUBMIT _ KEYS , ĠRESULT _ OK ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġkey Sharing Info Provider . reset () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsubmit Ep ide mio logy Data For TestResult ( key Sharing Info ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigation Observer . on Changed ( Share Keys Result Activity ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġconfirm Verified ( fetch Keys Flow , Ġsubmit Ep ide mio logy Data For TestResult , Ġnavigation Observer ) ĊĠĠĠ Ġ} Ċ } Ċ