package Ġspring kotlin Ċ Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . test . context . junit . jupiter . Spring Extension Ċ import Ġorg . springframework . test . web . servlet . MockMvc Ċ import Ġorg . springframework . test . web . servlet . request . MockMvc Request Builders . get Ċ import Ġorg . springframework . test . web . servlet . result . MockMvc Result Matchers . content Ċ import Ġorg . springframework . test . web . servlet . result . MockMvc Result Matchers . status Ċ import Ġorg . springframework . test . web . servlet . setup . MockMvc Builders Ċ Ċ @ Extend With ( Spring Extension :: class ) Ċ @ SpringBootTest ( web Environment Ġ= ĠSpring Boot Test . Web Environment . RANDOM _ PORT ) Ċ class ĠFeatures Controller Tests Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġmock Mvc : ĠMock Mvc ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrepo Ġ= ĠFake Features Repository () ĊĠĠĠĠĠĠĠ Ġval Ġcontroller Ġ= ĠFeatures Controller ( repo ) ĊĠĠĠĠĠĠĠ Ġmock Mvc Ġ= ĠMock Mvc Builders . standalone Setup ( controller ). build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` returns Ġall ĠKotlin Ġfeatures `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Mvc . perform ( get ("/ ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. andExpect ( status (). is Ok ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. andExpect ( content (). string (" Java Ġinter oper ability , Ġdata Ġclasses , Ġdefault Ġparameters , Ġnull Ġsafety ")) ĊĠĠĠ Ġ} Ċ }