package Ġcom . template Ċ Ċ import Ġcom . template . server . Node RPC Connection Ċ import Ġcom . template . server . rest Controller Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . hamcrest . Core Matchers . contains String Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . springframework . test . context . junit 4 . Spring Runner Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Inject Mocks Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . Mockito Annotations Ċ import Ġorg . omg . COR BA . Object Ċ import Ġorg . sky sc ream er . json assert . JSON Assert Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . beans . factory . annotation . Value Ċ import Ġorg . springframework . boot . test . autoconfigure . rest docs . Auto Configure Rest Docs Ċ import Ġorg . springframework . boot . test . autoconfigure . web . servlet . Web Mvc Test Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . boot . test . mock . mockito . Mock Bean Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . http . Response Entity . status Ċ import Ġorg . springframework . test . context . web . WebApp Configuration Ċ import Ġorg . springframework . test . web . client . match . Mock Rest Request Matchers . content Ċ import Ġorg . springframework . test . web . servlet . MockMvc Ċ import Ġorg . springframework . web . client . Rest Template Ċ import Ġorg . springframework . test . web . servlet . Mvc Result Ċ import Ġorg . springframework . test . web . servlet . RequestBuilder Ċ import Ġorg . springframework . test . web . servlet . Result Actions Ċ import Ġorg . springframework . test . web . servlet . request . MockMvc Request Builders Ċ import Ġorg . springframework . web . context . Web ApplicationContext Ċ import Ġjava . lang . reflect . Array . get Ċ import Ġjava . util .* Ċ import Ġjavax . inject . Inject Ċ Ċ import Ġorg . springframework . test . web . servlet . request . MockMvc Request Builders .* Ċ import Ġorg . springframework . test . web . servlet . result . MockMvc Result Matchers .* Ċ import Ġorg . springframework . test . web . servlet . setup . MockMvc Builders Ċ import Ġorg . springframework . test . web . servlet . setup . MockMvc Builders .* Ċ import Ġjavax . servlet . ServletContext Ċ import Ġkotlin . reflect . jvm . internal . impl . serialization . Proto Buf Ċ import Ġorg . springframework . boot . test . web . client . Test Rest Template ; Ċ import Ġorg . springframework . boot . test . web . client . get For Object Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . test . context . Context Configuration Ċ import Ġorg . springframework . test . context . junit 4 . Spring JUnit 4 Class Runner Ċ Ċ private Ġconst Ġval ĠCONT ROLL ER _ NAME Ġ= Ġ" config . controller . name " ĊĊ Ċ @ RunWith ( Spring JUnit 4 Class Runner :: class ) Ċ class Ġmain Controller Test { ĊĊĠ Ġ// Ġ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġval Ġrpc : ĠNode RPC Connection Ġ= ĠNode RPC Connection (" localhost ", Ġ" user 1 ", Ġ" test ", Ġ 1 0 0 0 6 ) ĊĠĠĠ Ġprivate Ġval Ġrpc Port : ĠInt Ġ= Ġ 1 0 0 0 6 ĊĠĠĠ Ġprivate Ġval Ġcontroller Name : ĠString Ġ= ĠCONT ROLL ER _ NAME ĊĊĠĠĠ Ġlateinit Ġvar Ġmock Mvc : ĠMock Mvc ĊĊĠĠĠ Ġ@ Inject Mocks ĊĠĠĠ Ġval Ġrest : Ġrest Controller Ġ= Ġ Ġrest Controller ( rpc , Ġrpc Port , Ġcontroller Name ) ĊĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠ Ġmock Mvc Ġ= ĠMock Mvc Builders . standalone Setup ( rest ). build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdata Test (){ ĊĊĠĠĠĠĠĠĠ Ġmock Mvc . perform ( get ("/ api / template / my currency ")) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. andExpect ( status (). is Ok ) ĊĊĠĠĠĠĠ Ġ// Ġcurrency Ġ= Ġthis . rest Template . get For Object ("/ api / template / my currency ", ĠCurrency :: class ) ĊĊĠĠĠ Ġ} ĊĊ Ċ } Ċ