### Question:
LoginHintHook implements AuthorizeRequestHook, TokenRequestHook { @Override public void afterAuthorizeSuccess(OAuth2Request o2request, Request request, Response response) { Series<CookieSetting> cookiesSetInThisResponse = response.getCookieSettings(); CookieSetting loginHintCookieSetting = cookiesSetInThisResponse.getFirst(LOGIN_HINT_COOKIE); if (loginHintCookieSetting != null && loginHintCookieSetting.getMaxAge() != 0) { cookiesSetInThisResponse.removeFirst(LOGIN_HINT_COOKIE); } removeCookie(request, response); }  @Override void beforeAuthorizeHandling(OAuth2Request o2request, Request request, Response response); @Override void afterAuthorizeSuccess(OAuth2Request o2request, Request request, Response response); @Override void afterTokenHandling(OAuth2Request o2request, Request request, Response response);  }### Answer:
@Test public void testAfterAuthorizeSuccessWithCookie() throws Exception { Series<Cookie> cookies = new Series<Cookie>(Cookie.class); cookies.add(LOGIN_HINT_COOKIE, "fred"); when(request.getCookies()).thenReturn(cookies); Series<CookieSetting> cookieSettings = new Series<CookieSetting>(CookieSetting.class); when(response.getCookieSettings()).thenReturn(cookieSettings); hook.afterAuthorizeSuccess(o2request, request, response); verify(request).getCookies(); verify(response, times(2)).getCookieSettings(); assertThat(cookieSettings.size()).isEqualTo(1); assertThat(cookieSettings.getFirst(LOGIN_HINT_COOKIE).getMaxAge()).isEqualTo(0); }