package Ġcom . m ct ech . features . navigation Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . fragment . app . Fragment Activity Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . argument Captor Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . assertj . core . api . Assertions . assertThat Thrown By Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠNavigator Test { ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnavigator : ĠNavigator ĊĠĠĠ Ġprivate Ġval Ġmock Activity Ġ= Ġmock < Fragment Activity >() ĊĠĠĠ Ġprivate Ġval Ġlinks Ġ= Ġmap Of < Screen , ĠClass < Fragment Activity >>( ĊĠĠĠĠĠĠĠ ĠScreen . Login Ġto ĠFragment Activity :: class . java ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġ` before Ġeach Ġtest `() Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator Ġ= ĠNavigator ( mock Activity , Ġlinks ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġnavigate Ġto Ġsupported Ġscreen `() Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigator . navigate To ( Screen . Login ) ĊĠĠĠĠĠĠĠ Ġargument Captor < Intent >(). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġverify ( mock Activity ). startActivity ( capture ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( first Value ). isNotNull () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` should Ġthrow Ġwhen Ġnavig ating Ġto Ġunsupported Ġscreen `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ Ġnavigator . navigate To ( Screen . Splash ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠUnsupported Navigation ( Screen . Splash ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ }