package Ġnet . at til as z abo . people demo . data . sources . u in ames Ċ Ċ import Ġio . reactivex . Flow able Ċ import Ġnet . at til as z abo . people demo . TestUtils . generate Network Person Ċ import Ġnet . at til as z abo . people demo . data . sources . u in ames . models . Person Network Ċ import Ġnet . at til as z abo . people demo . domain . people . Person Ċ import Ġnet . at til as z abo . people demo . mock Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . BDD Mockito . given Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠU IN ames Api Controller UnitTest Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġnetwork People Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ Ġgenerate Network Person (), ĊĠĠĠĠĠĠĠ Ġgenerate Network Person () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġapi Controller : ĠU IN ames Api Controller ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġapi Service : ĠU IN ames ApiService ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġinit Variables () Ġ{ ĊĠĠĠĠĠĠĠ Ġapi Service Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġapi Controller Ġ= ĠU IN ames Api Controller ( api Service ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġui Names Api Controller _ On Small er Than OrEqualTo Zero _ Returns Empty List () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġapi Controller . get Extended People ( 0 ). blocking First () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( result , ĠlistOf < Person Network >()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġui Names Api Controller _ For N Requested _ Returns N People () Ġ{ ĊĠĠĠĠĠĠĠ Ġgiven ( api Service . load People ( 2 )). willReturn ( Flow able . just ( network People )) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġapi Controller . get Extended People ( 2 ). blocking First () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresult , ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPerson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġnetwork People [ 0 ]. name Ġ+ Ġ" Ġ" Ġ+ Ġnetwork People [ 0 ]. surname , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġregion Ġ= Ġnetwork People [ 0 ]. region , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġage Ġ= Ġnetwork People [ 0 ]. age , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġphoto Ġ= Ġnetwork People [ 0 ]. photo ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPerson ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġnetwork People [ 1 ]. name Ġ+ Ġ" Ġ" Ġ+ Ġnetwork People [ 1 ]. surname , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġregion Ġ= Ġnetwork People [ 1 ]. region , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġage Ġ= Ġnetwork People [ 1 ]. age , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġphoto Ġ= Ġnetwork People [ 1 ]. photo ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ