Authenticator { public void logout() { removeCurrentUserLoginCookie(); HttpSession httpSession = sessionProvider.get(); httpSession.invalidate(); } @Inject  Authenticator(
            UserDao userDao,
            Provider<HttpSession> sessionProvider,
            PasswordSecurity passwordSecurity,
            CurrentUserDtoProvider currentUserDtoProvider,
            UserSessionDao userSessionDao); UserDto authenticateCredentials(String username, String password); UserDto authenticatCookie(String loggedInCookie); void logout(); Boolean isUserLoggedIn();  }
@Test public void logoutShouldDestroyTheSession(UserSessionDao userSessionDao) { UserDto userDto = mock(UserDto.class); given(userDto.getId()).willReturn(0L); CurrentUserDto currentUserDto = mock(CurrentUserDto.class); given(currentUserDto.getUser()).willReturn(userDto); given(currentUserDtoProvider.get()).willReturn(currentUserDto); authenticator.logout(); verify(httpSession).invalidate(); }