@Test public void activation() throws Exception { when(accountService.activate("abc")).thenReturn(true); mockMvc.perform(get("/account/activation?key=abc")) .andExpect(view().name("account/activation")) .andExpect(model().attribute("success", true)) .andExpect(cookie().secure("force-logout", true)) .andExpect(cookie().path("force-logout", "/")) .andExpect(cookie().value("force-logout", "true")); }
@RequestMapping("/activation") public ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response) { boolean success = accountService.activate(key); if (success) { Cookie cookie = new Cookie("force-logout", "true"); cookie.setPath("/"); cookie.setSecure(true); response.addCookie(cookie); } return new ModelAndView("account/activation").addObject("success", success); }
AccountController { @RequestMapping("/activation") public ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response) { boolean success = accountService.activate(key); if (success) { Cookie cookie = new Cookie("force-logout", "true"); cookie.setPath("/"); cookie.setSecure(true); response.addCookie(cookie); } return new ModelAndView("account/activation").addObject("success", success); } }
AccountController { @RequestMapping("/activation") public ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response) { boolean success = accountService.activate(key); if (success) { Cookie cookie = new Cookie("force-logout", "true"); cookie.setPath("/"); cookie.setSecure(true); response.addCookie(cookie); } return new ModelAndView("account/activation").addObject("success", success); }  }
AccountController { @RequestMapping("/activation") public ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response) { boolean success = accountService.activate(key); if (success) { Cookie cookie = new Cookie("force-logout", "true"); cookie.setPath("/"); cookie.setSecure(true); response.addCookie(cookie); } return new ModelAndView("account/activation").addObject("success", success); }  @RequestMapping("/sign-up") ModelAndView signUp(); @RequestMapping("/sign-in") String signIn(); @RequestMapping("/forget-password") String forgetPassword(); @RequestMapping("/reset-password") ModelAndView resetPassword(@RequestParam("key") String key); @RequestMapping("/settings") String settings(); @RequestMapping("/settings.part") ModelAndView settingsPart(AccountAccessToken accountAccessToken); @RequestMapping("/client-app") String clientApp(); @RequestMapping("/client-app.part") ModelAndView clientAppPart(AccountAccessToken accountAccessToken); @RequestMapping("/news-feed") String newsFeed(); @RequestMapping("/up-voted") String upVoted(); @RequestMapping("/news-feed.part") ModelAndView newsFeedPart(AccountAccessToken accountAccessToken,
      @RequestParam(value = "start", required = false) FlakeId startAssetId); @RequestMapping("/up-voted.part") ModelAndView upVotedPart(AccountAccessToken accountAccessToken,
      @RequestParam(value = "start", required = false) FlakeId startArticleId); @RequestMapping("/activation") ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response); }
AccountController { @RequestMapping("/activation") public ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response) { boolean success = accountService.activate(key); if (success) { Cookie cookie = new Cookie("force-logout", "true"); cookie.setPath("/"); cookie.setSecure(true); response.addCookie(cookie); } return new ModelAndView("account/activation").addObject("success", success); }  @RequestMapping("/sign-up") ModelAndView signUp(); @RequestMapping("/sign-in") String signIn(); @RequestMapping("/forget-password") String forgetPassword(); @RequestMapping("/reset-password") ModelAndView resetPassword(@RequestParam("key") String key); @RequestMapping("/settings") String settings(); @RequestMapping("/settings.part") ModelAndView settingsPart(AccountAccessToken accountAccessToken); @RequestMapping("/client-app") String clientApp(); @RequestMapping("/client-app.part") ModelAndView clientAppPart(AccountAccessToken accountAccessToken); @RequestMapping("/news-feed") String newsFeed(); @RequestMapping("/up-voted") String upVoted(); @RequestMapping("/news-feed.part") ModelAndView newsFeedPart(AccountAccessToken accountAccessToken,
      @RequestParam(value = "start", required = false) FlakeId startAssetId); @RequestMapping("/up-voted.part") ModelAndView upVotedPart(AccountAccessToken accountAccessToken,
      @RequestParam(value = "start", required = false) FlakeId startArticleId); @RequestMapping("/activation") ModelAndView activation(@RequestParam("key") String key, HttpServletResponse response);  }