package Ġid . i hw an . jet pack pro . home . tv show Ċ Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . Id ling Registry Ċ import Ġandroidx . test . espress o . action . View Actions . click Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . contrib . RecyclerView Actions Ċ import Ġandroidx . test . espress o . matcher . View Matchers . is Displayed Ċ import Ġid . i hw an . jet pack pro . R Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġid . i hw an . jet pack pro . Single Fragment Activity Ċ import Ġid . i hw an . jet pack pro . home . tv show . view . Tv Show Fragment Ċ import Ġid . i hw an . jet pack pro . utils . Esp ress o Id ling Resource Ċ import Ġorg . junit . Rule ĊĊ Ċ class ĠT v Show Fragment Test Ġ{ ĊĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġval Ġactivity Rule : ĠActivity Test Rule < Single Fragment Activity > Ġ= ĠActivity Test Rule ( Single Fragment Activity :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġtv Show Fragment Ġ= ĠT v Show Fragment () ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). register ( Esp ress o Id ling Resource . espress o Id ling Resource ) ĊĠĠĠĠĠĠĠ Ġactivity Rule . activity . set Fragment ( tv Show Fragment ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). unregister ( Esp ress o Id ling Resource . espress o Id ling Resource ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetData () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . tv Show RecyclerView )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . tv Show RecyclerView )). perform ( RecyclerView Actions . action On Item At Position < RecyclerView . ViewHolder >( 0 , Ġclick ())) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . favorite _ button )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . favorite _ button )). perform ( click ()) ĊĠĠĠ Ġ} Ċ }