package Ġcom . et ien nel enh art . e iff el . test Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . et ien nel enh art . e iff el . E iff el Ċ import Ġcom . et ien nel enh art . e iff el . view model . E iff el ViewModel Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . test . reset Main Ċ import Ġkotlinx . coroutines . test . set Main Ċ import Ġorg . junit . rules . Test Watcher Ċ import Ġorg . junit . runner . Description Ċ Ċ /** Ċ Ġ* ĠJ Unit ĠRule Ġthat Ġsets Ġthe Ġdispatch ers Ġused Ġin Ġ[ E iff el ViewModel ] Ġto Ġ[ Dispatch ers . Un conf ined ] Ġfor Ġsynchronous Ġexecution Ġand Ġuses Ġ[ Instant Task Executor Rule ] Ċ Ġ* Ġfor Ġ[ LiveData ] Ġsources . Ċ Ġ*/ Ċ @ Opt In ( Experimental Cor outines Api :: class ) Ċ class ĠE iff el ViewModel Test Rule Ġ: ĠTest Watcher () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlive Data Rule Ġ= Ġobject Ġ: ĠInstant Task Executor Rule () Ġ{ ĊĠĠĠĠĠĠĠ Ġpublic Ġoverride Ġfun Ġstarting ( description : ĠDescription ?) Ġ= Ġsuper . starting ( description ) ĊĊĠĠĠĠĠĠĠ Ġpublic Ġoverride Ġfun Ġfinished ( description : ĠDescription ?) Ġ= Ġsuper . finished ( description ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġstarting ( description : ĠDescription ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . starting ( description ) ĊĠĠĠĠĠĠĠ ĠE iff el . set Dispatch ers ( Dispatch ers . Un conf ined , ĠDispatch ers . Un conf ined ) ĊĠĠĠĠĠĠĠ ĠDispatch ers . set Main ( Dispatch ers . Un conf ined ) ĊĠĠĠĠĠĠĠ Ġlive Data Rule . starting ( description ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġfinished ( description : ĠDescription ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . finished ( description ) ĊĠĠĠĠĠĠĠ ĠE iff el . reset Dispatch ers () ĊĠĠĠĠĠĠĠ ĠDispatch ers . reset Main () ĊĠĠĠĠĠĠĠ Ġlive Data Rule . finished ( description ) ĊĠĠĠ Ġ} Ċ } Ċ