### Question:
ApiCatalogLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler { @Override public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) { HttpSession session = httpServletRequest.getSession(false); if (session != null) { session.invalidate(); } httpServletResponse.setStatus(HttpServletResponse.SC_OK); Cookie tokenCookie = new Cookie(authConfigurationProperties.getCookieProperties().getCookieName(), null); tokenCookie.setPath(authConfigurationProperties.getCookieProperties().getCookiePath()); tokenCookie.setComment(authConfigurationProperties.getCookieProperties().getCookieComment()); tokenCookie.setSecure(true); tokenCookie.setHttpOnly(true); tokenCookie.setMaxAge(0); httpServletResponse.addCookie(tokenCookie); SecurityContext context = SecurityContextHolder.getContext(); context.setAuthentication(null); SecurityContextHolder.clearContext(); }  @Override void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
                                Authentication authentication);  }### Answer:
@Test public void testOnLogoutSuccess() { MockHttpServletRequest httpServletRequest = new MockHttpServletRequest(); MockHttpSession mockHttpSession = new MockHttpSession(); httpServletRequest.setSession(mockHttpSession); MockHttpServletResponse httpServletResponse = new MockHttpServletResponse(); AuthConfigurationProperties securityConfigurationProperties = new AuthConfigurationProperties(); ApiCatalogLogoutSuccessHandler apiCatalogLogoutSuccessHandler = new ApiCatalogLogoutSuccessHandler(securityConfigurationProperties); apiCatalogLogoutSuccessHandler.onLogoutSuccess( httpServletRequest, httpServletResponse, new TokenAuthentication("TEST_TOKEN_STRING") ); assertTrue(mockHttpSession.isInvalid()); assertEquals(HttpStatus.OK.value(), httpServletResponse.getStatus()); Cookie cookie = httpServletResponse.getCookie( securityConfigurationProperties.getCookieProperties().getCookieName()); assertNotNull(cookie); assertTrue(cookie.getSecure()); assertTrue(cookie.isHttpOnly()); }