package Ġcom . news . splash Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġcom . news . R Ċ import Ġcom . news . data . Repository Ċ import Ġcom . news . get Or Await Value Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . clear All Mocks Ċ import Ġio . mock k . every Ċ import Ġio . mock k . impl . annotations . Mock K Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ Ċ class ĠSpl ash ViewModel Test Ġ{ ĊĊĠĠĠ Ġ// ĠExec utes Ġeach Ġtask Ġsynchronous ly Ġusing ĠArchitecture ĠComponents . ĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġinstant Executor Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġ@ Mock K ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġrepository : ĠRepository ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġsplash ViewModel : ĠSpl ash ViewModel ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this ) ĊĠĠĠĠĠĠĠ Ġsplash ViewModel Ġ= ĠSpl ash ViewModel ( repository ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġclean () Ġ{ ĊĠĠĠĠĠĠĠ Ġclear All Mocks () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġis First Time _ repository Return True _ navigate To On Board ing () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġrepository . is First Time () Ġ} Ġreturns Ġtrue ĊĠĠĠĠĠĠĠ Ġsplash ViewModel . is First Time Check () ĊĊĠĠĠĠĠĠĠ Ġval Ġnavigation Ġ= Ġsplash ViewModel . navigation . get Or Await Value () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( R . id . action _ splash Fragment _ to _ on Board ing Fragment , Ġnavigation ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġis First Time _ repository Return False _ navigate To Home () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġrepository . is First Time () Ġ} Ġreturns Ġfalse ĊĠĠĠĠĠĠĠ Ġsplash ViewModel . is First Time Check () ĊĊĠĠĠĠĠĠĠ Ġval Ġnavigation Ġ= Ġsplash ViewModel . navigation . get Or Await Value () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( R . id . action _ splash Fragment _ to _ home Fragment , Ġnavigation ) ĊĠĠĠ Ġ} Ċ }