ErrorController { @RequestMapping("/{statusCode:[0-9]+}/{messageKey:[a-zA-Z0-9\\.]+}") @PreAuthorize("permitAll") public String sendError(@PathVariable int statusCode, @PathVariable String messageKey, Model model) { model.addAttribute("statusCode", statusCode); model.addAttribute("messageKey", messageKey); return "/sendError"; }  @RequestMapping("/{statusCode:[0-9]+}/{messageKey:[a-zA-Z0-9\\.]+}") @PreAuthorize("permitAll") String sendError(@PathVariable int statusCode, @PathVariable String messageKey, Model model); static String timeout(); static String notFound(String messageKey); static String notModified(); static String forbidden();  }
@Test public void sendError() { String view = errorController.sendError(HttpServletResponse.SC_FORBIDDEN, "key", model); assertEquals("/sendError", view); verify(model).addAttribute("statusCode", HttpServletResponse.SC_FORBIDDEN); verify(model).addAttribute("messageKey", "key"); }