AccountController { @RequestMapping(value="/removeOpenId", method=RequestMethod.GET) @PreAuthorize("isAuthenticated()") public String removeOpenId(@RequestParam String openId, Authentication authentication) throws IOException { String loginName = authentication.getName(); User user = userStore.getUser(loginName); user.removeOpenId(openId); userStore.saveUser(user, user); return "redirect:/account/openId"; }  @RequestMapping(value="/myAccount", method=RequestMethod.GET) @PreAuthorize("isAuthenticated()") String getMyAccount(Model model); @RequestMapping(value="/openId", method=RequestMethod.GET) @PreAuthorize("isAuthenticated()") String getMyOpenIds(); @RequestMapping(value="/removeOpenId", method=RequestMethod.GET) @PreAuthorize("isAuthenticated()") String removeOpenId(@RequestParam String openId, Authentication authentication); @RequestMapping(value="/save", method=RequestMethod.POST) @PreAuthorize("isAuthenticated()") String saveMyAccount(@ModelAttribute @Valid AccountForm form, BindingResult bindingResult, Model model,
			Authentication authentication); @ModelAttribute AccountForm createAccountForm(@RequestParam(required=false) String password,
			@RequestParam(required=false) String newPassword1, @RequestParam(required=false) String newPassword2);  }
@Test public void removeOpenId() throws IOException { when(userStore.getUser("user")).thenReturn(user); when(authentication.getName()).thenReturn("user"); String view = accountController.removeOpenId("openId", authentication); assertEquals("/account/openId", removeViewPrefix(view)); assertRedirect(view); InOrder inOrder = inOrder(user, userStore); inOrder.verify(user).removeOpenId("openId"); inOrder.verify(userStore).saveUser(same(user), same(user)); }