### Question:
LoginHintHook implements AuthorizeRequestHook, TokenRequestHook { @Override public void afterTokenHandling(OAuth2Request o2request, Request request, Response response) { 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 testAfterTokenHandlingNoCookie() throws Exception { Series<Cookie> cookies = new Series<Cookie>(Cookie.class); when(request.getCookies()).thenReturn(cookies); hook.afterTokenHandling(o2request, request, response); verify(request).getCookies(); verifyNoMoreInteractions(response); }
@Test public void testAfterTokenHandling() 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.afterTokenHandling(o2request, request, response); verify(request).getCookies(); verify(response).getCookieSettings(); assertThat(cookieSettings.size()).isEqualTo(1); assertThat(cookieSettings.getFirst(LOGIN_HINT_COOKIE).getMaxAge()).isEqualTo(0); }