package Ġfr . free . n rw . commons . widget Ċ Ċ import Ġandroid . app . Activity Ċ import Ġfr . free . n rw . commons . Test Common s Application Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . android . controller . Activity Controller Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġjava . lang . reflect . Method Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( sdk Ġ= Ġ[ 2 1 ], Ġapplication Ġ= ĠTest Common s Application :: class ) Ċ class ĠHeight Limit ed RecyclerView UnitTests Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity Controller : ĠActivity Controller < Activity > ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠActivity ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġre cyclerView : ĠHeight Limit ed RecyclerView ĊĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity Controller Ġ= ĠRo bo lectric . build Activity ( Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġactivity Ġ= Ġactivity Controller . get () ĊĊĠĠĠĠĠĠĠ Ġre cyclerView Ġ= ĠHeight Limit ed RecyclerView ( activity ) ĊĠĠĠĠĠĠĠ Ġre cyclerView Ġ= ĠHeight Limit ed RecyclerView ( activity , Ġnull ) ĊĠĠĠĠĠĠĠ Ġre cyclerView Ġ= ĠHeight Limit ed RecyclerView ( activity , Ġnull , Ġ 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun ĠcheckNotNull () Ġ{ ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( re cyclerView ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun Ġtest On Measure () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmethod : ĠMethod Ġ= ĠHeight Limit ed RecyclerView :: class . java . getDeclared Method ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" on Measure ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInt :: class . java , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠInt :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġmethod . is Accessible Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġmethod . invoke ( re cyclerView , Ġ 0 , Ġ 0 ) ĊĠĠĠ Ġ} Ċ Ċ }