package Ġcom . spot light apps . mov iet ime . data . movie Ċ Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . spot light apps . mov iet ime . Main Coroutine Rule Ċ import Ġcom . spot light apps . mov iet ime . TestData Ċ import Ġcom . spot light apps . mov iet ime . data . network . Movie Service Ċ import Ġcom . spot light apps . mov iet ime . run Blocking Test Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . flow . first Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠA hm ad ĠJ aw id ĠMu ham m adi Ċ Ġ* Ġon Ġ 1 8 - 0 1 - 2 0 2 2 . Ċ Ġ*/ Ċ Ċ @ Experimental Cor outines Api Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠDefault Movie Repository Test Ġ{ ĊĊĠĠĠ Ġ@ get : ĠRule ĊĠĠĠ Ġval Ġcoroutine Rule Ġ= ĠMain Coroutine Rule () ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġmovie Service : ĠMovie Service ĊĊĠĠĠ Ġlateinit Ġvar Ġmovie Repository : ĠDefault Movie Repository ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġmovie Repository Ġ= ĠDefault Movie Repository ( movie Service ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( movie Service . movie List ()). thenReturn ( TestData . movie ApiModel 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Movie List _ returns Correct List () Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlist Ġ= Ġmovie Repository . get Movie List ( false ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( list . first (). size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( list . first ()[ 0 ]. title ). isEqualTo ( TestData . result 1 . title ) ĊĠĠĠĠĠĠĠ ĠassertThat ( list . first ()[ 0 ]. vote Average ). isInstanceOf ( String :: class . java ) ĊĠĠĠ Ġ} Ċ }