@Test public void helloNameTest() throws Exception { String name = "siyoon"; mockMvc.perform(get("/hello/{name}", name).accept(MediaType.TEXT_HTML)) .andExpect(status().isOk()) .andDo(print()); }
@GetMapping("/hello/{name}") public @ResponseBody String helloName(@PathVariable String name) { return "hello " + name; }
MyController { @GetMapping("/hello/{name}") public @ResponseBody String helloName(@PathVariable String name) { return "hello " + name; } }
MyController { @GetMapping("/hello/{name}") public @ResponseBody String helloName(@PathVariable String name) { return "hello " + name; }  }
MyController { @GetMapping("/hello/{name}") public @ResponseBody String helloName(@PathVariable String name) { return "hello " + name; }  @GetMapping("/hello") String hello(Model model); @GetMapping("/hello/{name}") @ResponseBody String helloName(@PathVariable String name); @GetMapping("/hello/{name1}/{name2}") @ResponseBody String helloName(@PathVariable(name = "name1") String name1, @PathVariable(name = "name2") String name2); }
MyController { @GetMapping("/hello/{name}") public @ResponseBody String helloName(@PathVariable String name) { return "hello " + name; }  @GetMapping("/hello") String hello(Model model); @GetMapping("/hello/{name}") @ResponseBody String helloName(@PathVariable String name); @GetMapping("/hello/{name1}/{name2}") @ResponseBody String helloName(@PathVariable(name = "name1") String name1, @PathVariable(name = "name2") String name2);  }