package Ġnet . dub lin . bus . ui . view . realtime Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . support . test . Instrumentation Registry Ċ import Ġandroid . support . test . espress o . Esp ress o . on View Ċ import Ġandroid . support . test . espress o . Id ling Registry Ċ import Ġandroid . support . test . espress o . action . View Actions . click Ċ import Ġandroid . support . test . espress o . assertion . View Assertions . matches Ċ import Ġandroid . support . test . espress o . matcher . View Matchers .* Ċ import Ġandroid . support . test . filters . Large Test Ċ import Ġandroid . support . test . rule . Activity Test Rule Ċ import Ġandroid . support . test . runner . Android JUnit 4 Ċ import Ġandroid . view . View Ċ import Ġnet . dub lin . bus . R Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . set Dispatcher No Items Response 2 0 0 Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . set Dispatcher Real Time Response 2 0 0 Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . set Dispatcher Response 5 0 0 Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . set Dispatcher Time Warning No Items Response 2 0 0 Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . set Dispatcher Time Warning With Items Response 2 0 0 Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . shutdown Ċ import Ġnet . dub lin . bus . ui . view . utilities . Mock Server . start Ċ import Ġnet . dub lin . bus . ui . view . utilities . TestUtils . check Recycler Has Desc endant Ċ import Ġnet . dub lin . bus . ui . view . utilities . TestUtils . sleep Ċ import Ġnet . dub lin . bus . ui . view . utilities . TestUtils . sleep Long Ċ import Ġnet . dub lin . bus . ui . view . utilities . TestUtils . swipe Refresh Ċ import Ġorg . hamcrest . Core Matchers . not Ċ import Ġorg . hamcrest . Matchers . startsWith Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Large Test Ċ class ĠReal Time Screen Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġactivity Test Rule Ġ= ĠActivity Test Rule ( Real Time Activity :: class . java , Ġfalse , Ġfalse ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġstart () ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). register () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun Ġafter () Ġ{ ĊĠĠĠĠĠĠĠ Ġshutdown () ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). unregister () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġload Data _ Displayed In Ui ( launch Activity : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( launch Activity ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Dispatcher Real Time Response 2 0 0 () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġsleep () ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ number _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ NUMBER )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ description _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ DESCRIPTION )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ line _ note _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" 3 8 ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" D am ast own Ġvia ĠC ord uff ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" 3 Ġmin ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" 4 6 a ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" Ph o enix ĠP k Ġvia ĠDon ny bro ok ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" 9 Ġmin ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġload Data _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( true ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġservice WithError _ Update Swipe _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Response 5 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĠĠĠĠĠĠĠ Ġset Dispatcher Real Time Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġswipe Refresh ( R . id . real _ swipe _ refresh _ layout ) ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġload Data _ update Swipe _ api WithError _ shows Error Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( true ) ĊĠĠĠĠĠĠĠ Ġset Dispatcher Response 5 0 0 () ĊĊĠĠĠĠĠĠĠ Ġswipe Refresh ( R . id . real _ swipe _ refresh _ layout ) ĊĠĠĠĠĠĠĠ Ġval Ġtext Ġ= ĠInstrument ation Registry . getTarget Context (). getString ( R . string . error _ message ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( text )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġno Items And W arm ing Message _ update Swipe _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Time Warning No Items Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġ// Check Ġno Ġitems Ġand Ġwarm ing Ġmessage ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ line _ note _ view )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġval Ġtext Ġ= ĠInstrument ation Registry . getTarget Context (). getString ( R . string . real _ time _ error _ message ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( text )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( WARNING )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġ// Reload ĠData Ġand Ġcheck Ġapi Ġwith Ġitems ĊĠĠĠĠĠĠĠ Ġset Dispatcher Real Time Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġswipe Refresh ( R . id . real _ swipe _ refresh _ layout ) ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( false ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwith Items And W arm ing Message _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Time Warning With Items Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ number _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ NUMBER )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ description _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ DESCRIPTION )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ line _ note _ view )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġ// Check Ġwarning ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( startsWith ( WARNING _ 2 ))). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġ// Check Ġitems ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" 1 ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" Sh an ard ĠRoad Ġvia ĠO ' Conn ell ĠStreet ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 0 , Ġ" 2 Ġmin ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" 1 1 ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" St ĠP app in 's ĠR d Ġvia ĠD rum cond ra ") ĊĠĠĠĠĠĠĠ Ġcheck Recycler Has Desc endant ( R . id . real _ recycler _ view , Ġ 1 , Ġ" 1 6 Ġmin ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwith Items And W arm ing Message _ update Swipe _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Time Warning With Items Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġ// Check Ġwarning ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ number _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ NUMBER )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ description _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ DESCRIPTION )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ line _ note _ view )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġ// Reload Ġdata Ġwithout Ġwarm ing ĊĠĠĠĠĠĠĠ Ġset Dispatcher Real Time Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġswipe Refresh ( R . id . real _ swipe _ refresh _ layout ) ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġno Items And W arm ing Message _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Time Warning No Items Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ line _ note _ view )). check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġno Items _ shows Message Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher No Items Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ progress _ bar _ view )). check ( matches ( not < View >( is Displayed ()))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ number _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ NUMBER )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ description _ stop _ view )). check ( matches ( with Text ( startsWith ( STOP _ DESCRIPTION )))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġval Ġmessage Error Required Ġ= ĠInstrument ation Registry . getTarget Context (). getString ( R . string . real _ time _ error _ message ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( message Error Required )). check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġerror Connection _ Shows Error Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Response 5 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġsleep () ĊĠĠĠĠĠĠĠ Ġval Ġtext Ġ= ĠInstrument ation Registry . getTarget Context (). getString ( R . string . error _ message ) ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( text )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . real _ message _ empty _ view )). check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġerror Connection _ retry _ Displayed In Ui () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Dispatcher Response 5 0 0 () ĊĠĠĠĠĠĠĠ Ġlaunch Activity () ĊĊĠĠĠĠĠĠĠ Ġset Dispatcher Real Time Response 2 0 0 () ĊĠĠĠĠĠĠĠ Ġval Ġtext Ġ= ĠInstrument ation Registry . getTarget Context (). getString ( R . string . title _ retry ) ĊĠĠĠĠĠĠĠ Ġsleep () ĊĠĠĠĠĠĠĠ Ġon View ( with Text ( text )). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġload Data _ Displayed In Ui ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġlaunch Activity () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent () ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Real Time Activity . EXTRA _ DESCRIPTION , ĠSTOP _ DESCRIPTION ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Real Time Activity . EXTRA _ STOP _ NUMBER , ĠSTOP _ NUMBER ) ĊĠĠĠĠĠĠĠ Ġactivity Test Rule . launch Activity ( intent ) ĊĠĠĠĠĠĠĠ Ġsleep Long () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠSTOP _ NUMBER Ġ= Ġ" 2 " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠSTOP _ DESCRIPTION Ġ= Ġ" TEST Ġ 2 " ĊĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠWARNING Ġ= Ġ" Due Ġto Ġweather Ġconditions , Ġthere Ġwill Ġbe Ġno ĠD ub lin ĠBus Ġservices ĠTh urs . Ġ 1 st Ġor ĠFri . Ġ 2 nd ĠMarch . ĠSee Ġd ub lin bus . ie Ġfor Ġupdates ." ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠWARNING _ 2 Ġ= Ġ" Red ĠWeather ĠAlert Ġ- ĠD ub lin ĠBus Ġservices Ġare Ġexperiencing Ġsignificant Ġdelays Ġdue Ġto Ġweather Ġconditions ." ĊĠĠĠ Ġ} Ċ } Ċ