package Ġcom . die g of aj ardo . stack exchange app . data . repository Ċ Ċ import Ġcom . die g of aj ardo . stack exchange app . data . model . Only In name Query Model Ċ import Ġcom . die g of aj ardo . stack exchange app . data . source . server . Remote DataSource Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Return Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . times Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġio . reactivex . Observable Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Inject Mocks Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠUser Repository Test Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġremote DataSource : ĠRemote DataSource ĊĊĠĠĠ Ġ@ Inject Mocks ĊĠĠĠ Ġlateinit Ġvar Ġuser Repository : ĠUser Repository ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Users _ when Called _ remote DataSource _ get Users _ is Called _ with _ same _ query Model () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġquery Model Ġ= ĠOnly In name Query Model (" some Ġvalue ") ĊĠĠĠĠĠĠĠ Ġwhenever ( remote DataSource . get Users ( query Model )). do Return ( Observable . empty ()) ĊĠĠĠĠĠĠĠ Ġuser Repository . get Users ( query Model ). blocking Subscribe () ĊĠĠĠĠĠĠĠ Ġverify ( remote DataSource , Ġtimes ( 1 )). get Users ( query Model ) ĊĠĠĠ Ġ} Ċ }