package Ġcom . day a . ta ha . presentation . broadcast Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġcom . day a . shared . ta ha . data . Resource Ċ import Ġcom . day a . shared . ta ha . domain . use case . Broad Cast News UseCase Ċ import Ġcom . day a . shared . ta ha . domain . use case . GetDefault Topic UseCase Ċ import Ġcom . day a . ta ha . utils .* Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . kotlin .* ĊĊ Ċ class ĠBroad Cast ViewModel Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġinstant Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġcoroutine Rule Ġ= ĠMain Coroutine Rule () ĊĊĠĠĠ Ġprivate Ġval ĠgetDefault Topic UseCase : ĠGet Default Topic UseCase Ġ= Ġmock () ĊĠĠĠ Ġprivate Ġval Ġbroad Cast News UseCase Ġ: ĠBroad Cast News UseCase Ġ= Ġmock () ĊĠĠĠ Ġlateinit Ġvar Ġbroad Cast ViewModel : ĠBroad Cast ViewModel ĊĊĠĠĠ Ġprivate Ġval Ġdummy Topic Ġ= ĠDummy . topic [ 0 ] ĊĠĠĠ Ġprivate Ġval Ġdummy Res Suc ces Ġ= ĠResource . success ( Dummy . topic ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġbroad Cast ViewModel Ġ= ĠBroad Cast ViewModel ( getDefault Topic UseCase , broad Cast News UseCase ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Topic () Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( getDefault Topic UseCase ( Unit )). thenReturn ( dummy Res Suc ces ) ĊĠĠĠĠĠĠĠ Ġval Ġinitial Result Ġ= Ġbroad Cast ViewModel . get Topic (). get Or Await Value () ĊĠĠĠĠĠĠĠ ĠassertThat ( initial Result Ġis ĠResource . Loading ) ĊĊĠĠĠĠĠĠĠ Ġ// end Result ĊĠĠĠĠĠĠĠ Ġbroad Cast ViewModel . get Topic (). observe ForTesting Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġend Result Ġ= Ġbroad Cast ViewModel . get Topic (). value ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( end Result ). isEqualTo ( dummy Res Suc ces ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` delete ĠUri Image `() Ġ{ ĊĠĠĠĠĠĠĠ Ġbroad Cast ViewModel . delete Uri Image () ĊĠĠĠĠĠĠĠ ĠassertThat ( broad Cast ViewModel . get Uri Image (). get Or Await Value ()). isEqualTo ( null ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ