package Ġes . np atar ino . android . got challenge . data . remote Ċ Ċ import Ġes . np atar ino . android . got challenge . data . model . Character Ċ import Ġes . np atar ino . android . got challenge . test . Default Plugin Test Setup Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . ob servers . Test Observer Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Inject Mocks Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . Mockito . verify Ċ import Ġorg . mockito . Mockito Annotations Ċ Ċ class ĠGot Remote DataSource Test Ġ: ĠDefault Plugin Test Setup () Ġ{ ĊĊĠĠĠ Ġ@ Inject Mocks ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġremote DataSource : ĠGot Remote DataSource ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġgot Service : ĠGot Service ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ= ĠMockito Annotations . init Mocks ( this ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Sources () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcharacter Ġ= Ġmock ( Character :: class . java ) ĊĠĠĠĠĠĠĠ Ġval Ġcharacter List Ġ= Ġarray ListOf < Character >() ĊĠĠĠĠĠĠĠ Ġcharacter List . add ( character ) ĊĊĠĠĠĠĠĠĠ Ġ` when `( got Service . get Characters ()). thenReturn ( Single . just ( character List )) ĊĠĠĠĠĠĠĠ Ġval Ġtest Observer Ġ= ĠTest Observer < ArrayList < Character >>() ĊĊĠĠĠĠĠĠĠ Ġremote DataSource . get Characters (). subscribe ( test Observer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( got Service ). get Characters () ĊĠĠĠ Ġ} Ċ }