/* Ċ Ġ* ĠCopyright ĠÂ© Ġ 2 0 2 0 ĠN HS X . ĠAll Ġrights Ġreserved . Ċ Ġ*/ Ċ Ċ package Ġuk . n hs . n hs x . sonar . android . app . scenarios Ċ Ċ import Ġorg . joda . time . LocalDate Ċ import Ġorg . joda . time . Local Time Ċ import Ġorg . junit . Test Ċ import Ġuk . n hs . n hs x . sonar . android . app . R Ċ import Ġuk . n hs . n hs x . sonar . android . app . inbox . Test Info Ċ import Ġuk . n hs . n hs x . sonar . android . app . inbox . TestResult Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Default State Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Ex posed State Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Ex posed Sy mptom atic State Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Positive State Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Sy mptom Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . Sy mptom atic State Ċ import Ġuk . n hs . n hs x . sonar . android . app . status . User State Ċ import Ġuk . n hs . n hs x . sonar . android . app . test helpers . base . Scenario Test Ċ import Ġuk . n hs . n hs x . sonar . android . app . test helpers . robots . Bottom Dialog Robot Ċ import Ġuk . n hs . n hs x . sonar . android . app . test helpers . robots . Reference Code Robot Ċ import Ġuk . n hs . n hs x . sonar . android . app . test helpers . robots . Status Robot Ċ import Ġuk . n hs . n hs x . sonar . android . app . util . non Empty Set Of Ċ import Ġkotlin . reflect . K Class Ċ Ċ class ĠNegative TestResult Test Ġ: ĠScenario Test () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġstatus Robot Ġ= ĠStatus Robot () ĊĠĠĠ Ġprivate Ġval Ġreference Code Robot Ġ= ĠReference Code Robot () ĊĠĠĠ Ġprivate Ġval Ġbottom Dialog Robot Ġ= ĠBottom Dialog Robot () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test While In Neutral () Ġ{ ĊĠĠĠĠĠĠĠ Ġstart App With ( testData . default State ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Default State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test After Be coming Sy mptom atic () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . sy mptom atic Y esterday () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Default State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test Before Be coming Sy mptom atic () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . sy mptom atic Tom orrow () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Sy mptom atic State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test While In Ex posed () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . ex posed Y esterday () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Ex posed State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test While In Positive () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . positive Today () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Positive State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test While In Ex posed Sy mptom atic Within Exposure Window () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . ex posed Sy mptom atic Y esterday () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Ex posed State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test While In Ex posed Sy mptom atic Outside Exposure Window () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexposed State Ġ= ĠUser State . ex posed ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġexposure Date Ġ= ĠtestData . y esterday . minus Days ( 1 4 ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠUser State . ex posed Sy mptom atic ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsy mptoms Date Ġ= ĠtestData . y esterday , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstate Ġ= Ġexposed State , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsy mptoms Ġ= Ġnon Empty Set Of ( Sy mptom . TEMP ER ATURE ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Default State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test Before Be coming Ex posed Sy mptom atic () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠtestData . ex posed Sy mptom atic Today () ĊĊĠĠĠĠĠĠĠ Ġstart App With ( state ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . y esterday ) ĊĊĠĠĠĠĠĠĠ Ġdismiss Negative TestResult () ĊĠĠĠĠĠĠĠ Ġverify Status Is ( Ex posed Sy mptom atic State :: class ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtook Test And Click s TestResult Mean ing () Ġ{ ĊĠĠĠĠĠĠĠ Ġstart App With ( testData . default State ) ĊĊĠĠĠĠĠĠĠ Ġreceive Negative TestResult ( testData . today ) ĊĊĠĠĠĠĠĠĠ Ġbottom Dialog Robot . click First C ta Button () ĊĊĠĠĠĠĠĠĠ Ġreference Code Robot . check Activity Is Displayed () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġreceive Negative TestResult ( test Date : ĠLocalDate ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtest AppContext . apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsimulate TestResult Notification Received ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTest Info ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresult Ġ= ĠTest Result . NEGATIVE , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdate Ġ= Ġtest Date . to DateTime ( Local Time . now ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclick On Notification ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . string . test _ result _ notification _ title , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . string . test _ result _ notification _ text ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġ< T Ġ: ĠUser State > Ġverify Status Is ( user State : ĠK Class < T >) Ġ{ ĊĠĠĠĠĠĠĠ Ġstatus Robot . check Activity Is Displayed ( user State ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġdismiss Negative TestResult () Ġ{ ĊĠĠĠĠĠĠĠ Ġbottom Dialog Robot . check TestResult Dialog Is Displayed ( TestResult . NEGATIVE ) ĊĠĠĠĠĠĠĠ Ġbottom Dialog Robot . click Second C ta Button () ĊĠĠĠ Ġ} Ċ } Ċ