package Ġcom . h ana 0 5 3 . micro post . service Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Intent Ċ import Ġcom . h ana 0 5 3 . micro post . pages . login . Login Activity Ċ import Ġcom . h ana 0 5 3 . micro post . pages . main . MainActivity Ċ import Ġcom . h ana 0 5 3 . micro post . pages . main . MainActivity . Companion . REQUEST _ POST Ċ import Ġcom . h ana 0 5 3 . micro post . pages . micro post new . Micro post New Activity Ċ import Ġcom . h ana 0 5 3 . micro post . pages . related user list . Related UserList Activity Ċ import Ġcom . h ana 0 5 3 . micro post . pages . signup . Signup Activity Ċ import Ġcom . h ana 0 5 3 . micro post . pages . users how . User Show Activity Ċ import Ġcom . h ana 0 5 3 . micro post . testing . Ro bo lectric Base Test Ċ import Ġcom . h ana 0 5 3 . micro post . testing . Test User Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . ro bo lectric . Ro bo lectric Ċ import Ġorg . ro bo lectric . Shadow s ĊĊ Ċ class ĠNavigator Test Ġ: ĠRo bo lectric Base Test () Ġ{ ĊĊĠĠĠ Ġlateinit Ġprivate Ġvar Ġactivity : ĠTest Activity ĊĠĠĠ Ġlateinit Ġprivate Ġvar Ġnavigator : ĠNavigator ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity Ġ= ĠRo bo lectric . setup Activity ( Test Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġnavigator Ġ= ĠNavigator Impl ( activity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To User Show () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= ĠTest User ĊĊĠĠĠĠĠĠĠ Ġnavigator . navigate To User Show ( user . id ) ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( User Show Activity :: class . java . name ) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . extras . getLong ( User Show Activity . KEY _ USER _ ID )). isEqualTo ( 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Main () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Main () ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( MainActivity :: class . java . name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Signup () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Signup () ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( Signup Activity :: class . java . name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Login () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Login () ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( Login Activity :: class . java . name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Follow ings () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Following List ( 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( Related UserList Activity :: class . java . name ) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . extras . getLong ( Related UserList Activity . KEY _ USER _ ID )). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . extras . get Serializable ( Related UserList Activity . KEY _ LIST _ TYPE ) Ġas ĠRelated UserList Activity . ListType ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( Related UserList Activity . ListType . FOLLOW ING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Follow ers () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Follower List ( 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( Related UserList Activity :: class . java . name ) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . extras . getLong ( Related UserList Activity . KEY _ USER _ ID )). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . extras . get Serializable ( Related UserList Activity . KEY _ LIST _ TYPE ) Ġas ĠRelated UserList Activity . ListType ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( Related UserList Activity . ListType . FOL LOWER ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Navigate To Micro post New () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To Micro post New () ĊĊĠĠĠĠĠĠĠ Ġval Ġshadow Ġ= ĠShadow s . shadow Of ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow . next Started Activity ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . component . className ). isEqualTo ( Micro post New Activity :: class . java . name ) ĊĊĠĠĠĠĠĠĠ Ġshadow . receive Result ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIntent ( activity , ĠMicro post New Activity :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity . RESULT _ OK , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIntent () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( activity . post Received ). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠTest Activity Ġ: ĠActivity () Ġ{ ĊĠĠĠĠĠĠĠ Ġvar Ġpost Received Ġ= Ġfalse ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġon Activity Result ( request Code : ĠInt , ĠresultCode : ĠInt , Ġdata : ĠIntent ?) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsuper . on Activity Result ( request Code , ĠresultCode , Ġdata ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( request Code Ġ== ĠREQUEST _ POST ) Ġpost Received Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }