package Ġcom . github . c et one k . big biz nis . domain . service Ċ Ċ import Ġcom . github . c et one k . big biz nis . domain . repository . Exchange Rate Repository Ċ import Ġcom . github . c et one k . big biz nis . application . utility . example Rate Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . mockito . BDD Mockito . given Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . jupiter . Mockito Extension Ċ Ċ @ Extend With ( Mockito Extension :: class ) Ċ class ĠExchange Rate Service Test Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġrepository : ĠExchange Rate Repository ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġsynchronize UseCase : ĠExchange Rate Service ĊĊĠĠĠ Ġlateinit Ġvar Ġuse Case Fetch : ĠFetch Exchange Rate UseCase ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġuse Case Fetch Ġ= ĠFetch Exchange Rate UseCase ( repository , Ġsynchronize UseCase ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` service Ġf etches Ġlatest Ġexchange Ġrates `() Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġgiven ĊĠĠĠĠĠĠĠ Ġgiven ( repository . findAll Rates From Last Day ()). willReturn ( listOf ( example Rate )) ĊĠĠĠĠĠĠĠ Ġ// Ġwhen ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġuse Case Fetch . fetch Latest Rates () ĊĠĠĠĠĠĠĠ Ġ// Ġthen ĊĠĠĠĠĠĠĠ ĠassertThat ( result . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . first ()). isEqualTo ( example Rate ) ĊĠĠĠ Ġ} Ċ Ċ }