@Test public void testShowRegisterForm() throws Exception { mockMvc.perform(get("/register").accept(MediaType.APPLICATION_XHTML_XML)) .andExpect(view().name("register")) .andExpect(model().attributeExists("aUser")) .andExpect(status().isOk()); verifyZeroInteractions(userService); }
@RequestMapping public String showRegisterForm(Model model) { model.addAttribute("aUser", new UserEntity()); return "register"; }
RegisterController { @RequestMapping public String showRegisterForm(Model model) { model.addAttribute("aUser", new UserEntity()); return "register"; } }
RegisterController { @RequestMapping public String showRegisterForm(Model model) { model.addAttribute("aUser", new UserEntity()); return "register"; } @Autowired  RegisterController(IUserService userService); }
RegisterController { @RequestMapping public String showRegisterForm(Model model) { model.addAttribute("aUser", new UserEntity()); return "register"; } @Autowired  RegisterController(IUserService userService); @RequestMapping String showRegisterForm(Model model); @RequestMapping(method = RequestMethod.POST) String registerUser(
            @Valid @ModelAttribute("aUser") UserEntity userEntity,
            BindingResult results); @RequestMapping("is-available") @ResponseBody String available(@RequestParam String username); }
RegisterController { @RequestMapping public String showRegisterForm(Model model) { model.addAttribute("aUser", new UserEntity()); return "register"; } @Autowired  RegisterController(IUserService userService); @RequestMapping String showRegisterForm(Model model); @RequestMapping(method = RequestMethod.POST) String registerUser(
            @Valid @ModelAttribute("aUser") UserEntity userEntity,
            BindingResult results); @RequestMapping("is-available") @ResponseBody String available(@RequestParam String username);  }