NotificationExpirationManagement implements RedisExpirationStrategy { @Override public void startExpiredSessionsTask(final SessionManager sessionManager) { sessionManager.submit(null, new SubscriptionRunner(sessionManager)); Runnable taskTriggerExpiration = new TriggerExpiredSessionsTask(); cleanupFuture = sessionManager.schedule("redis.expiration-cleanup", taskTriggerExpiration, ONE_MINUTE); if (sticky) { Runnable taskForceExpiration = new CleanHangingSessionsTask(sessionManager); forceCleanupFuture = sessionManager.schedule("redis.force-cleanup", taskForceExpiration, ONE_MINUTE); } } NotificationExpirationManagement(RedisFacade redis, RedisSessionRepository redisSession, String namespace,
      String owner, String keyPrefix, boolean sticky); @Override void sessionDeleted(SessionData session); @Override void sessionTouched(SessionData session); @Override void startExpiredSessionsTask(final SessionManager sessionManager); @Override void close(); void reset(); @Override void sessionIdChange(SessionData session);  }
@Test public void testSubscriptionRunner() { SessionManager sessionManager = mock(SessionManager.class); expiration.startExpiredSessionsTask(sessionManager); ArgumentCaptor<NotificationExpirationManagement.SubscriptionRunner> cleanupCapture = ArgumentCaptor.forClass(NotificationExpirationManagement.SubscriptionRunner.class); verify(sessionManager).submit((String)isNull(), cleanupCapture.capture()); cleanupCapture.getValue().run(); verify(redis).psubscribe(any(RedisFacade.RedisPubSub.class), anyString()); }