package Ġcom . dic od ing jet pack pro . mov iec atalog ue . presentation . tv show Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġandroidx . paging . Paging Data Ċ import Ġcom . dic od ing jet pack pro . mov iec atalog ue . domain . Api Constants . DEFAULT _ TYPE Ċ import Ġcom . dic od ing jet pack pro . mov iec atalog ue . domain . repository . Tv Show Repository Ċ import Ġcom . dic od ing jet pack pro . mov iec atalog ue . shared test . Dummy . tv Shows Ċ import Ġcom . dic od ing jet pack pro . mov iec atalog ue . shared test . Main Coroutine Rule Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ 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 Ġio . mock k . verify Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . flow . flow Of Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ Ċ @ Experimental Cor outines Api Ċ class ĠGet Paged Tv Shows UseCase Impl Test Ġ{ ĊĊĠĠĠ Ġ// Ġmock Ġrepository ĊĠĠĠ Ġ@ Mock K ĊĠĠĠ Ġlateinit Ġvar Ġrepository : ĠT v Show Repository ĊĊĠĠĠ Ġ// Ġclass Ġunder Ġtest ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġget Paged Tv Shows UseCase : ĠGet Paged Tv Shows UseCase Impl ĊĊĠĠĠ Ġ// Ġset Ġthe Ġmain Ġcoroutine Ġdispatcher Ġfor Ġunit Ġtesting ĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġmain Coroutine Rule Ġ= ĠMain Coroutine Rule () ĊĊĠĠĠ Ġ// Ġexecute Ġeach Ġtask Ġsynchronous ly Ġusing ĠArchitecture ĠComponents . ĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġinstant Executor Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠInitializes Ġproperties Ġannotated Ġwith Ġ@ Mock K ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this , Ġrelax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġget Paged Tv Shows UseCase Ġ= ĠGet Paged Tv Shows UseCase Impl ( repository ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ= Ġun mock k All () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Paged Tv Shows Return Expected Value () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpage d Data Ġ= Ġflow Of ( Paging Data . from ( tv Shows )) ĊĠĠĠĠĠĠĠ Ġ// Ġmock Ġrepository Ġreturn Ġdata ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġrepository . get Paged Tv Shows ( DEFAULT _ TYPE ) Ġ} Ġreturns Ġpage d Data ĊĠĠĠĠĠĠĠ Ġ// Ġwhen Ġget Ġpage d Ġtv Ġshow ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġget Paged Tv Shows UseCase ( DEFAULT _ TYPE ) ĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġrepository . get Paged Tv Shows ( DEFAULT _ TYPE ) Ġ} ĊĠĠĠĠĠĠĠ Ġ// Ġthen Ġcontains Ġexpected Ġvalue ĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isEqualTo ( page d Data ) ĊĠĠĠ Ġ} Ċ } Ċ