SessionManagerImpl implements SessionManager { @PermitAll @Override public void invalidateSessions( Date currentDate ) { if ( currentDate == null ) { currentDate = new Date( System.currentTimeMillis() ); } for ( Iterator<Session> iterator = sessionContext.values().iterator(); iterator.hasNext(); ) { final Session session = iterator.next(); if ( session.getEndDate().getTime() <= currentDate.getTime() ) { iterator.remove(); } } } SessionManagerImpl( IdentityDataService identityDataService ); @Override void startSessionController(); @Override void stopSessionController(); @Override Session startSession( String sessionId, Session userSession, User user ); @Override Session getValidSession( String sessionId ); @Override void extendSessionTime( Session userSession ); @Override void extendSessionTime( String sessionId ); @Override void endSession( String sessionId ); @PermitAll @Override void invalidateSessions( Date currentDate ); @Override int getSessionTimeout(); static void setSessionTimeout( final int sessionTimeout ); @Override Map getSessionContext();  }
@Test public void invalidateSessions() { Date currentDate = DateUtils.addMinutes(session.getStartDate(), sessionManager.getSessionTimeout()); System.out.println( "Session Time:" + session.getEndDate() + "\nCurrentTime:"+ currentDate); assertTrue( session.getEndDate().getTime() <= currentDate.getTime() ); sessionManager.invalidateSessions( currentDate ); assertNull( sessionManager.getValidSession(sessionId)); }