package Ġpl . mb ale cz ny . rapid _ mg . login Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . net . Network Info Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġio . reactivex . schedul ers . Test Scheduler Ċ import Ġorg . junit . Before Ċ import Ġorg . mockito . Mockito Ċ import Ġpl . mb ale cz ny . rapid _ mg . R apid App Ċ import Ġpl . mb ale cz ny . rapid _ mg . data . Twitter DataSource Ċ import Ġpl . mb ale cz ny . rapid _ mg . data . Twitter Repo Ċ import Ġpl . mb ale cz ny . rapid _ mg . util . base . Base Presenter Ċ import Ġpl . mb ale cz ny . rapid _ mg . util . base . Base View Ċ import Ġpl . mb ale cz ny . rapid _ mg . util . schedul ers . Base Scheduler Provider Ċ Ċ /** Ċ Ġ* Ġ@ author ĠM arius z ĠB ale cz ny Ċ Ġ* Ġ@ date Ġ 1 8 . 0 2 . 1 7 Ċ Ġ*/ Ċ abstract Ġclass ĠBase Tweet List Presenter Test < V Ġ: ĠBase View , ĠT Ġ: ĠBase Presenter < V >> Ġ{ ĊĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġpresenter : ĠT ĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġview : ĠV ĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġrepo : ĠTwitter DataSource ĊĊĠĠĠ Ġprotected Ġvar Ġremote DataSource : ĠTwitter DataSource Ġ= Ġmock () ĊĠĠĠ Ġprotected Ġvar Ġlocal DataSource : ĠTwitter DataSource Ġ= Ġmock () ĊĠĠĠ Ġprotected Ġval Ġscheduler Provider : ĠBase Scheduler Provider Ġ= Ġmock () ĊĊĠĠĠ Ġprotected Ġval Ġscheduler : ĠTest Scheduler Ġ= ĠTest Scheduler () ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġopen Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġrepo Ġ= ĠTwitter Repo ( remote DataSource , Ġlocal DataSource , Ġscheduler Provider ) ĊĊĠĠĠĠĠĠĠ Ġmock Schedulers () ĊĠĠĠĠĠĠĠ Ġmock Network Availability Check ( true ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġfun Ġmock Schedulers () Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( scheduler Provider . io ()). thenReturn ( scheduler ) ĊĠĠĠĠĠĠĠ Ġwhenever ( scheduler Provider . ui ()). thenReturn ( scheduler ) ĊĠĠĠĠĠĠĠ Ġwhenever ( scheduler Provider . computation ()). thenReturn ( scheduler ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġfun Ġmock Network Availability Check ( available : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrapid App Ġ= ĠMockito . mock ( R apid App :: class . java ) ĊĠĠĠĠĠĠĠ ĠR apid App . set Test Instance ( rapid App ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcm : ĠConnect ivity Manager Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġval Ġinfo : ĠNetwork Info Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġwhenever ( info . isConnected Or Connecting ). thenReturn ( available ) ĊĠĠĠĠĠĠĠ Ġwhenever ( cm . active Network Info ). thenReturn ( info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( rapid App . getSystem Service ( Context . CONNECT IVITY _ SERVICE )). thenReturn ( cm ) ĊĠĠĠ Ġ} Ċ }