package Ġmk . web factory . android template . data . repository . movie Ċ Ċ import Ġio . reactivex . rx java 3 . core . Single Ċ import Ġmk . web factory . template . data . repository . movie . Movie Remote DataSource Ċ import Ġmk . web factory . template . data . repository . movie . Movie Repository Ċ import Ġmk . web factory . template . model . api . Pag inated Response Ċ import Ġmk . web factory . template . model . movie . MediaType Ċ import Ġmk . web factory . template . model . movie . Movie Ċ import Ġmk . web factory . template . model . movie . Show Ċ import Ġmk . web factory . template . model . movie . Tv Show Ċ import Ġmk . web factory . template . network . api . Movie ApiService Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ import Ġorg . mockito . kotlin . any Ċ import Ġorg . mockito . kotlin . eq Ċ Ċ /** Ċ Ġ* ĠTests Ġfor Ġ[ Movie Repository ] Ċ Ġ*/ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠMovie Remote DataSource Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġmock Movie Ġ= Ġmock ( Movie :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġmovie Items At Page 1 Ġ= ĠlistOf < Show >( mock Movie ) ĊĠĠĠ Ġprivate Ġval Ġmovie Page 1 Response Ġ= ĠPag inated Response < Show >( 1 , Ġ 1 0 , Ġmovie Items At Page 1 ) ĊĊĠĠĠ Ġprivate Ġval Ġmock Tv Show Ġ= Ġmock ( Tv Show :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġtv Show Items At Page 1 Ġ= ĠlistOf < Show >( mock Tv Show ) ĊĠĠĠ Ġprivate Ġval Ġtv Show Page 1 Response Ġ= ĠPag inated Response < Show >( 1 , Ġ 1 0 , Ġtv Show Items At Page 1 ) ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġmovie ApiService : ĠMovie ApiService ĊĠĠĠ Ġlateinit Ġvar Ġmovie Remote DataSource : ĠMovie Remote DataSource ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġmovie Remote DataSource Ġ= ĠMovie Remote DataSource (" userId ", Ġmovie ApiService ) ĊĊĠĠĠĠĠĠĠ Ġ` when `( movie ApiService . get Trend ing ( eq ( MediaType . MOV IE ), Ġany (), Ġeq ( 1 ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( Single . just ( movie Page 1 Response )) ĊĠĠĠĠĠĠĠ Ġ` when `( movie ApiService . get Trend ing ( eq ( MediaType . TV ), Ġany (), Ġeq ( 1 ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( Single . just ( tv Show Page 1 Response )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Trend ing Group ed Response () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġretrieved Items Ġ= Ġmovie Remote DataSource . get Trend ing Shows ( 1 ). blocking Get () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( listOf ( mock Movie , Ġmock Tv Show ), Ġretrieved Items . items ) ĊĠĠĠ Ġ} Ċ }