class MyController {

    @GetMapping("/hello/{name}")
    public @ResponseBody
    String helloName(@PathVariable String name) {
        return "hello " + name;
    }

}

class MyControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @Test
    public void helloNameTest() throws Exception {

        String name = "siyoon";

        mockMvc.perform(get("/hello/{name}", name).accept(MediaType.TEXT_HTML))
                .andExpect(status().isOk())
                .andDo(print());
    }

}