package Ġorg . health api . android . boilerplate . remote Ċ Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġio . reactivex . Single Ċ import Ġorg . health api . android . boilerplate . data . model . Cov id 1 9 Stats Entity Ċ import Ġorg . health api . android . boilerplate . remote . mapper . Cov id 1 9 Stats Entity Mapper Ċ import Ġorg . health api . android . boilerplate . remote . test . factory . Cov id 1 9 Stats Factory Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . JUnit 4 Ċ Ċ @ RunWith ( JUnit 4 :: class ) Ċ class ĠC ov id 1 9 Stats Remote Impl Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġentity Mapper : ĠC ov id 1 9 Stats Entity Mapper ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcov id 1 9 Stats Service : ĠC ov id 1 9 Stats Service ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcov id 1 9 Stats Remote Impl : ĠC ov id 1 9 Stats Remote Impl ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġentity Mapper Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġcov id 1 9 Stats Service Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġcov id 1 9 Stats Remote Impl Ġ= ĠC ov id 1 9 Stats Remote Impl ( covid 1 9 Stats Service , Ġentity Mapper ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// < editor - fold Ġdesc =" Get ĠBuffer o os "> ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Buffer o os Comp letes () Ġ{ ĊĠĠĠĠĠĠĠ Ġstub Cov id 1 9 Stats Service Get Stats ( Single . just ( Cov id 1 9 Stats Factory . make Response ())) ĊĠĠĠĠĠĠĠ Ġval Ġtest Observer Ġ= Ġcov id 1 9 Stats Remote Impl . get Stats (). test () ĊĠĠĠĠĠĠĠ Ġtest Observer . assert Complete () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Buffer o os Returns Data () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= ĠC ov id 1 9 Stats Factory . make Response () ĊĠĠĠĠĠĠĠ Ġstub Cov id 1 9 Stats Service Get Stats ( Single . just ( listOf ( response ))) ĊĠĠĠĠĠĠĠ Ġval Ġentities Ġ= Ġmutable ListOf < Cov id 1 9 Stats Entity >() ĊĠĠĠĠĠĠĠ Ġresponse . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġentities . add ( entity Mapper . map From Remote ( it )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtest Observer Ġ= Ġcov id 1 9 Stats Remote Impl . get Stats (). test () ĊĠĠĠĠĠĠĠ Ġtest Observer . assert Value ( entities ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġstub Cov id 1 9 Stats Service Get Stats ( single : ĠSingle < List < Cov id 1 9 Stats Service . Response >>) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( covid 1 9 Stats Service . get Stats All ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( single ) ĊĠĠĠ Ġ} Ċ }