package Ġorg . jes per anc in ha . sm td . f urniture . client Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . jes per anc in ha . sm td . f urniture . configuration . F urniture Configuration Ċ import Ġorg . jes per anc in ha . sm td . f urniture . model . Ch air Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . test . context . Context Configuration Ċ import Ġorg . springframework . test . context . junit . jupiter . Spring Extension Ċ import Ġorg . springframework . test . web . client . Expected Count . once Ċ import Ġorg . springframework . test . web . client . Mock Rest ServiceServer Ċ import Ġorg . springframework . test . web . client . match . Mock Rest Request Matchers . request To Ċ import Ġorg . springframework . test . web . client . response . Mock Rest Response Creators . with Success Ċ import Ġorg . springframework . web . client . Rest Template Ċ import Ġorg . springframework . web . client . support . Rest Gateway Support ĊĊ Ċ @ Extend With ( Spring Extension :: class ) Ċ @ Context Configuration ( classes Ġ= Ġ[ F urniture Configuration :: class , ĠExternal Client :: class ]) Ċ open Ġclass ĠExternal Client Test ( Ċ ) Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġmock Server : ĠMock Rest ServiceServer ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġrest Template : ĠRest Template ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġexternal Client : ĠExternal Client ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgateway Ġ= ĠRest Gateway Support () ĊĠĠĠĠĠĠĠ Ġgateway . rest Template Ġ= Ġrest Template ĊĠĠĠĠĠĠĠ Ġmock Server Ġ= ĠMock Rest ServiceServer . create Server ( gateway ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġexternal Ch airs () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Server . expect ( once (), Ġrequest To (" http :// localhost : 9 0 0 1 ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. and Respond ( with Success (" [] ", ĠMediaType . APPLICATION _ JSON )) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult : ĠList < Ch air > Ġ= Ġexternal Client . external Ch airs () ĊĠĠĠĠĠĠĠ Ġprintln (" external Ch airs : Ġ$ result ") ĊĊĠĠĠĠĠĠĠ Ġmock Server . verify () ĊĠĠĠĠĠĠĠ ĠassertThat ( result ). has Size ( 0 ) ĊĠĠĠ Ġ} Ċ }