package Ġorg . kot link . ui . search Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġorg . hamcrest . Matchers Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . kot link . IN BOX _ ALIAS Ċ import Ġorg . kot link . With MockMvc SetUp Ċ import Ġorg . kot link . core . alias . Alias Service Ċ import Ġorg . kot link . perform Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . autoconfigure . web . servlet . Web Mvc Test Ċ import Ġorg . springframework . boot . test . mock . mockito . Mock Bean Ċ import Ġorg . springframework . test . web . servlet . MockMvc Ċ import Ġorg . springframework . test . web . servlet . request . MockMvc Request Builders Ċ import Ġorg . springframework . test . web . servlet . result . MockMvc Result Matchers Ċ Ċ @ Web Mvc Test ( Link Search Ui Controller :: class ) Ċ @ With MockMvc SetUp Ċ class ĠLink Search Ui Controller Test ( ĊĠĠĠ Ġ@ Autowired Ġprivate Ġval Ġm vc : ĠMock Mvc Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ Mock Bean ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġalias Service : ĠAlias Service ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ`' search Links ' Ġshould Ġreturn Ġthe Ġpage Ġwith Ġaliases Ġthat Ġmatched Ġthe Ġinput `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( alias Service . search Aliases Matching At Least Part Of Input (" inbox ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( listOf ( IN BOX _ ALIAS )) ĊĊĠĠĠĠĠĠĠ Ġm vc . perform ( MockMvc Request Builders . get ("/ ui / search ? input = inbox ")) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġand Expect ( MockMvc Result Matchers . status (). is Ok ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġand Expect ( MockMvc Result Matchers . content (). string ( Matchers . contains String ( IN BOX _ ALIAS . full Link ))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ