@Test public void ensureHandlesDeleteForTodoWithGivenId() throws Exception { mockMvc.perform(delete("/todos/42")).andExpect(status().is3xxRedirection()).andExpect(redirectedUrl("/")); verify(todoService).deleteTodo(42L); }
@DeleteMapping("/todos/{id}") public String deleteTodo(@PathVariable Long id) { todoService.deleteTodo(id); return REDIRECT_TO_INDEX; }
TodoController { @DeleteMapping("/todos/{id}") public String deleteTodo(@PathVariable Long id) { todoService.deleteTodo(id); return REDIRECT_TO_INDEX; } }
TodoController { @DeleteMapping("/todos/{id}") public String deleteTodo(@PathVariable Long id) { todoService.deleteTodo(id); return REDIRECT_TO_INDEX; } TodoController(TodoService todoService); }
TodoController { @DeleteMapping("/todos/{id}") public String deleteTodo(@PathVariable Long id) { todoService.deleteTodo(id); return REDIRECT_TO_INDEX; } TodoController(TodoService todoService); @GetMapping("/") String index(Model model); @GetMapping(path = "/", params = { "filter" }) String filtered(Model model,
        @RequestParam(name = "filter", defaultValue = "all") String filter); @GetMapping(path = "/", params = { "action", "item-id" }) String editTodo(@RequestParam("item-id") Long id); @PostMapping("/todos") String newTodo(@RequestParam("item-text") String itemText); @DeleteMapping(path = "/todos", params = { "filter=completed" }) String clearCompleted(); @PostMapping(path = "/todos/toggle", params = { "filter=completed" }) String markAllCompleted(); @DeleteMapping("/todos/{id}") String deleteTodo(@PathVariable Long id); @PostMapping("/todos/{id}") String editTodo(@PathVariable Long id,
        @RequestParam("item-text") String itemText); @PostMapping("/todos/{id}/status") String toggleStatus(@PathVariable Long id); }
TodoController { @DeleteMapping("/todos/{id}") public String deleteTodo(@PathVariable Long id) { todoService.deleteTodo(id); return REDIRECT_TO_INDEX; } TodoController(TodoService todoService); @GetMapping("/") String index(Model model); @GetMapping(path = "/", params = { "filter" }) String filtered(Model model,
        @RequestParam(name = "filter", defaultValue = "all") String filter); @GetMapping(path = "/", params = { "action", "item-id" }) String editTodo(@RequestParam("item-id") Long id); @PostMapping("/todos") String newTodo(@RequestParam("item-text") String itemText); @DeleteMapping(path = "/todos", params = { "filter=completed" }) String clearCompleted(); @PostMapping(path = "/todos/toggle", params = { "filter=completed" }) String markAllCompleted(); @DeleteMapping("/todos/{id}") String deleteTodo(@PathVariable Long id); @PostMapping("/todos/{id}") String editTodo(@PathVariable Long id,
        @RequestParam("item-text") String itemText); @PostMapping("/todos/{id}/status") String toggleStatus(@PathVariable Long id);  }