package Ġcom . ches ire . nek ome . flow . series Ċ Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . matcher . View Matchers . isChecked Ċ import Ġandroidx . test . espress o . matcher . View Matchers . isNot Checked Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġcom . ches ire . nek ome . Activity Ċ import Ġcom . ches ire . nek ome . R Ċ import Ġcom . ches ire . nek ome . helpers . injector Ċ import Ġcom . ches ire . nek ome . helpers . login Ċ import Ġcom . ches ire . nek ome . k its u . Auth Provider Ċ import Ġcom . sch ib st ed . sp ain . bar ista . assertion . Bar ista Enabled Assertions . assert Disabled Ċ import Ġcom . sch ib st ed . sp ain . bar ista . assertion . Bar ista Enabled Assertions . assert Enabled Ċ import Ġcom . sch ib st ed . sp ain . bar ista . assertion . Bar ista List Assertions . assert Custom Assertion At Position Ċ import Ġcom . sch ib st ed . sp ain . bar ista . assertion . Bar ista List Assertions . assert Displayed At Position Ċ import Ġcom . sch ib st ed . sp ain . bar ista . interaction . Bar ista Click Interactions . click On Ċ import Ġcom . sch ib st ed . sp ain . bar ista . interaction . Bar ista List Interactions . click ListItem Ċ import Ġcom . sch ib st ed . sp ain . bar ista . interaction . Bar ista Menu Click Interactions . click Menu Ċ import Ġcom . sch ib st ed . sp ain . bar ista . rule . clear data . Clear Preferences Rule Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġjavax . inject . Inject Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠFilter Tests Ġ{ ĊĠĠĠ Ġ/* ĊĠĠĠ ĠSince Ġthe ĠMaterial Dialog s Ġlibrary Ġis Ġbeing Ġused , Ġthe Ġway Ġto Ġaccess Ġparts Ġof Ġthe Ġdialog Ġneeds Ġto ĊĠĠĠ Ġbe Ġslightly Ġdifferent , Ġsince Ġthe Ġlibrary Ġuses Ġa Ġbunch Ġof Ġcustom Ġviews , Ġsuch Ġas Ġa Ġcontrol Ġof Ġa ĊĠĠĠ Ġcheck Ġbox Ġ+ Ġa Ġtext Ġview Ġinside Ġeach Ġitem Ġof Ġa Ġre cycler Ġview , Ġas Ġsuch Ġall Ġof Ġthe Ġtests Ġneed Ġto ĊĠĠĠ Ġinteract Ġwith Ġ` R . id . md _ recyclerview _ content ` Ġand Ġthe Ġother Ġ` R . id . md _* ` Ġitems . ĊĊĠĠĠ ĠThese Ġtests Ġare Ġnot Ġexactly Ġrobust , Ġsince Ġthey Ġassume Ġinitial Ġstate Ġand Ġrely Ġon Ġknowing Ġthe Ġids ĊĠĠĠ Ġfrom Ġthe ĠMaterial Dialog s Ġlibrary , Ġbut Ġthey Ġshould Ġdo Ġfor Ġnow . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġval Ġactivity Ġ= ĠActivity Test Rule ( Activity :: class . java , Ġfalse , Ġfalse ) ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġclear Preferences Rule Ġ= ĠClear Preferences Rule () ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġauth Provider : ĠAuth Provider ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġinjector . inject ( this ) ĊĠĠĠĠĠĠĠ Ġauth Provider . login () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilter Dialog Display sWith All Options () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity . launch Activity ( null ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġassert Displayed At Position ( R . id . md _ recyclerview _ content , Ġ 0 , ĠR . string . filter _ by _ current ) ĊĠĠĠĠĠĠĠ Ġassert Displayed At Position ( R . id . md _ recyclerview _ content , Ġ 1 , ĠR . string . filter _ by _ completed ) ĊĠĠĠĠĠĠĠ Ġassert Displayed At Position ( R . id . md _ recyclerview _ content , Ġ 2 , ĠR . string . filter _ by _ on _ hold ) ĊĠĠĠĠĠĠĠ Ġassert Displayed At Position ( R . id . md _ recyclerview _ content , Ġ 3 , ĠR . string . filter _ by _ d ropped ) ĊĠĠĠĠĠĠĠ Ġassert Displayed At Position ( R . id . md _ recyclerview _ content , Ġ 4 , ĠR . string . filter _ by _ pl anned ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilter Dialog Has Correct Default Choices () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity . launch Activity ( null ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġassert Position State ( 0 , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 1 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 2 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 3 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 4 , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilter Dialog Ret ains Last Choices () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity . launch Activity ( null ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġclick ListItem ( R . id . md _ recyclerview _ content , Ġ 2 ) ĊĠĠĠĠĠĠĠ Ġclick ListItem ( R . id . md _ recyclerview _ content , Ġ 4 ) ĊĠĠĠĠĠĠĠ Ġclick On ( R . id . md _ button _ positive ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġassert Position State ( 0 , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 1 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 2 , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 3 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 4 , Ġtrue ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilter Dialog Cancel s On Cancel Hit () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity . launch Activity ( null ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġclick ListItem ( R . id . md _ recyclerview _ content , Ġ 2 ) ĊĠĠĠĠĠĠĠ Ġclick ListItem ( R . id . md _ recyclerview _ content , Ġ 4 ) ĊĠĠĠĠĠĠĠ Ġclick On ( R . id . md _ button _ negative ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġassert Position State ( 0 , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 1 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 2 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 3 , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġassert Position State ( 4 , Ġfalse ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfilter Dialog Confirm Disabled If No Filter () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity . launch Activity ( null ) ĊĠĠĠĠĠĠĠ Ġclick Menu ( R . id . menu Filter ) ĊĊĠĠĠĠĠĠĠ Ġassert Enabled ( R . id . md _ button _ positive ) ĊĠĠĠĠĠĠĠ Ġclick ListItem ( R . id . md _ recyclerview _ content , Ġ 0 ) ĊĊĠĠĠĠĠĠĠ Ġassert Disabled ( R . id . md _ button _ positive ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Position State ( position : ĠInt , Ġexpected Checked : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Custom Assertion At Position ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . id . md _ recyclerview _ content , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġposition , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . id . md _ control , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmatches ( if Ġ( expected Checked ) Ġis Checked () Ġelse Ġis Not Checked ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ