package Ġcom . tel en . easy line up . domain Ċ Ċ import Ġcom . tel en . easy line up . domain . model . Player Ċ import Ġcom . tel en . easy line up . domain . repository . Player Repository Ċ import Ġcom . tel en . easy line up . domain . use cases . Get Players Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . ob servers . Test Observer Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . Mockito Annotations Ċ import Ġorg . mockito . junit . Mockito JUnit Runner ĊĊ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ internal Ġclass ĠGet Players Tests Ġ{ ĊĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġplayer Dao : ĠPlayer Repository ĊĠĠĠ Ġlateinit Ġvar Ġm Get Players : ĠGet Players ĊĊĠĠĠ Ġlateinit Ġvar Ġplayers : ĠMutable List < Player > ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ ĠMockito Annotations . init Mocks ( this ) ĊĠĠĠĠĠĠĠ Ġm Get Players Ġ= ĠGet Players ( player Dao ) ĊĊĠĠĠĠĠĠĠ Ġval Ġplayer 1 Ġ= ĠPlayer ( id Ġ= Ġ 1 L , Ġteam Id Ġ= Ġ 1 L , Ġname Ġ= Ġ" t oto ", Ġsh irt Number Ġ= ĠĠ 1 , Ġlicense Number Ġ= Ġ 1 , Ġimage Ġ= Ġnull , Ġpositions Ġ= Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġplayer 2 Ġ= ĠPlayer ( id Ġ= Ġ 2 L , Ġteam Id Ġ= Ġ 1 L , Ġname Ġ= Ġ" t ata ", Ġsh irt Number Ġ= ĠĠ 2 , Ġlicense Number Ġ= Ġ 2 , Ġimage Ġ= Ġnull , Ġpositions Ġ= Ġ 1 ) ĊĊĠĠĠĠĠĠĠ Ġplayers Ġ= Ġarray ListOf ( player 1 , Ġplayer 2 ) ĊĊĠĠĠĠĠĠĠ ĠMockito .` when `( player Dao . get Players ( 1 L )). thenReturn ( Single . just ( players )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Get Players Team () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= ĠTest Observer < Get Players . Response Value >() ĊĠĠĠĠĠĠĠ Ġm Get Players . execute UseCase ( Get Players . Request Values ( 1 L )). subscribe ( observer ) ĊĠĠĠĠĠĠĠ Ġobserver . await () ĊĠĠĠĠĠĠĠ Ġobserver . assert Complete () ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( players [ 0 ], Ġobserver . values (). first (). players [ 0 ]) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( players [ 1 ], Ġobserver . values (). first (). players [ 1 ]) ĊĠĠĠ Ġ} Ċ }