package Ġcom . ak in ci . chat ter . feature . splash . view model Ċ Ċ import Ġcom . ak in ci . chat ter . a helper . Instant Executor Extension Ċ import Ġcom . ak in ci . chat ter . common . storage . Preferences Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . squareup . mos hi . M oshi Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . every Ċ import Ġio . mock k . impl . annotations . Mock K Ċ import Ġio . mock k . un mock k All Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġorg . junit . jupiter . api . After Each Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ Ċ @ Experimental Cor outines Api Ċ @ Extend With ( Instant Executor Extension :: class ) Ċ class ĠSpl ash ViewModel Test Ġ{ ĊĊĠĠĠ Ġ@ Mock K ĊĠĠĠ Ġlateinit Ġvar Ġpreferences : ĠPreferences ĊĊĠĠĠ Ġlateinit Ġvar Ġsplash ViewModel : ĠSpl ash ViewModel ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this , Ġrelax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġpreferences . get Stored Tag ( any ()) Ġ} Ġreturns Ġ" Logged - In " ĊĊĠĠĠĠĠĠĠ Ġsplash ViewModel Ġ= ĠSpl ash ViewModel ( preferences ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After Each ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ Ġun mock k All () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` fetch Ġall Ġrecipes Ġcalled Ġreturns ĠResource ĠSuccess `() Ġ{ ĊĠĠĠĠĠĠĠ Ġ// no Ġneed Ġto Ġcall Ġsomething Ġin ĠVM 's Ġinit Ġblock Ġlive Ġdata Ġis Ġset . ĊĠĠĠĠĠĠĠ Ġsplash ViewModel . is LoggedIn . observe Fore ver { ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( it ). isEqualTo (" Logged - In ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }