/* Ċ Ġ* ĠCopyright Ġ 2 0 2 1 ĠOn a ĠSystems , ĠInc Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġorg . smart register . fhir core . anc . ui . an cc are . register Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . fragment . app . commit Now Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġcom . google . android . fhir . sync . Sync Ċ import Ġdagger . h ilt . android . testing . Bind Value Ċ import Ġdagger . h ilt . android . testing . H ilt Android Rule Ċ import Ġdagger . h ilt . android . testing . H ilt Android Test Ċ import Ġio . mock k . every Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . mock k Object Ċ import Ġio . mock k . un mock k Object Ċ import Ġjavax . inject . Inject Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . ro bo lectric . Ro bo lectric Ċ import Ġorg . ro bo lectric . Shadow s . shadow Of Ċ import Ġorg . smart register . fhir core . anc . An c Application Ċ import Ġorg . smart register . fhir core . anc . app . f akes . F aker Ċ import Ġorg . smart register . fhir core . anc . data . model . Patient Item Ċ import Ġorg . smart register . fhir core . anc . data . model . Visit Status Ċ import Ġorg . smart register . fhir core . anc . ro bo lectric . Ro bo lectric Test Ċ import Ġorg . smart register . fhir core . anc . ui . details . Patient Details Activity Ċ import Ġorg . smart register . fhir core . anc . ui . family . register . Family Register Activity Ċ import Ġorg . smart register . fhir core . anc . util . An c Json Specification Provider Ċ import Ġorg . smart register . fhir core . engine . configuration . Configuration Registry Ċ import Ġorg . smart register . fhir core . engine . ui . register . model . Register Filter Type Ċ import Ġorg . smart register . fhir core . engine . util . Secure Shared Preference Ċ import Ġorg . smart register . fhir core . engine . util . SharedPreferences Helper Ċ Ċ @ H ilt Android Test Ċ class ĠAn c Register Fragment Test Ġ: ĠRo bo lectric Test () Ġ{ ĊĠ Ġ@ get : Rule ( order Ġ= Ġ 0 ) Ġval Ġh ilt Rule Ġ= ĠH ilt Android Rule ( this ) ĊĊĠ Ġ@ Bind Value ĊĠ Ġvar Ġconfiguration Registry : ĠConfiguration Registry Ġ= ĊĠĠĠ ĠFaker . build Test Configuration Registry (" anc ", Ġmock k ()) ĊĠ Ġ@ Inject Ġlateinit Ġvar Ġjson Specification Provider : ĠAn c Json Specification Provider ĊĊĠ Ġ@ Bind Value Ġval Ġshared Preferences Helper : ĠSharedPreferences Helper Ġ= Ġmock k () ĊĠ Ġ@ Bind Value Ġval Ġsecure Shared Preference : ĠSecure Shared Preference Ġ= Ġmock k () ĊĊĠ Ġprivate Ġlateinit Ġvar Ġregister Fragment : ĠAn c Register Fragment ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġmock k Object ( Sync ) ĊĊĠĠĠ Ġh ilt Rule . inject () ĊĊĠĠĠ Ġevery Ġ{ Ġshared Preferences Helper . read ( any (), Ġany < String >()) Ġ} Ġreturns Ġ"" ĊĠĠĠ Ġregister Fragment Ġ= ĠAn c Register Fragment () ĊĊĠĠĠ Ġval Ġregister Activity Ġ= ĊĠĠĠĠĠ ĠRo bo lectric . build Activity ( Family Register Activity :: class . java ). create (). get () ĊĠĠĠ Ġregister Activity . support FragmentManager . commit Now Ġ{ ĊĠĠĠĠĠ Ġadd ( register Fragment , ĠAn c Register Fragment . TAG ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġfun Ġcleanup () Ġ{ ĊĠĠĠ Ġun mock k Object ( Sync ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Navigate To Details Should G oto To An c Details Activity () Ġ{ ĊĠĠĠ Ġval Ġpatient Item Ġ= ĠPatient Item ( patient Identifier Ġ= Ġ" test _ patient ") ĊĠĠĠ Ġregister Fragment . on Item Clicked ( Open Patient Profile , Ġpatient Item ) ĊĊĠĠĠ Ġval Ġexpected Intent Ġ= ĠIntent ( register Fragment . context , ĠPatient Details Activity :: class . java ) ĊĠĠĠ Ġval Ġactual Intent Ġ= ĊĠĠĠĠĠ Ġshadow Of ( Application Provider . getApplicationContext < An c Application > ()). next Started Activity ĊĊĠĠĠ ĠAssert . assertEquals ( expected Intent . component , Ġactual Intent . component ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Perform Filter Should Return True () Ġ{ ĊĊĠĠĠ ĠAssert . assertTrue ( ĊĠĠĠĠĠ Ġregister Fragment . perform Filter ( Register Filter Type . SEARCH _ FILTER , ĠPatient Item (), Ġ"") ĊĠĠĠ Ġ) ĊĠĠĠ ĠAssert . assertTrue ( ĊĠĠĠĠĠ Ġregister Fragment . perform Filter ( ĊĠĠĠĠĠĠĠ Ġregister Filter Type Ġ= ĠRegister Filter Type . SEARCH _ FILTER , ĊĠĠĠĠĠĠĠ Ġdata Ġ= ĠPatient Item ( patient Identifier Ġ= Ġ" 1 2 3 4 5 "), ĊĠĠĠĠĠĠĠ Ġvalue Ġ= Ġ" 1 2 3 4 5 " ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Perform Over due Filter Should Return True () Ġ{ ĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġregister Fragment . perform Filter ( ĊĠĠĠĠĠĠĠ Ġregister Filter Type Ġ= ĠRegister Filter Type . OVER D UE _ FILTER , ĊĠĠĠĠĠĠĠ Ġdata Ġ= ĠPatient Item ( patient Identifier Ġ= Ġ" 1 2 3 4 5 ", Ġvisit Status Ġ= ĠVisit Status . OVER D UE ), ĊĠĠĠĠĠĠĠ Ġvalue Ġ= Ġ" 1 2 3 4 5 " ĊĠĠĠĠĠ Ġ) ĊĠĠĠ ĠAssert . assertTrue ( result ) ĊĠ Ġ} Ċ } Ċ