SessionManager implements Closeable { public Future<?> submit(String timer, Runnable task) { if (timer != null) { return executors.submit(new RunnableWithTimer(timer, task)); } else { return executors.submit(task); } } SessionManager(ExecutorFacade executors, SessionFactory factory, SessionRepository repository,
      SessionTracking tracking, SessionNotifier notifier, SessionConfiguration configuration, ClassLoader classLoader); RepositoryBackedSession fetchSession(String sessionId, boolean updateTimestamp); RepositoryBackedSession getSession(RequestWithSession request, boolean create,
      SessionTracking.IdAndSource forceId); void propagateSession(RequestWithSession request, ResponseWithSessionId response); void delete(String sessionId, boolean expired); void requestFinished(); Future<?> submit(String timer, Runnable task); ScheduledFuture<?> schedule(String timer, Runnable task, long period); void deleteAsync(final String sessionId, final boolean expired); SessionRepository getRepository(); SessionNotifier getNotifier(); void invokeCommit(RepositoryBackedSession session); SessionConfiguration getConfiguration(); ClassLoader getSessionClassLoader(); SerializerDeserializer getSerializerDeserializer(); void invalidationConflict(RepositoryBackedSession session, boolean onExpiry); MetricRegistry getMetrics(); String encodeUrl(RequestWithSession request, String url); void reset(); @Override void close(); void switchSessionId(RepositoryBackedSession session); void switchSessionId(RepositoryBackedSession session, String forceId); @Override String toString(); void remove(SessionData sessionData); boolean isConnected();  }
@Test public void testSubmit() { Runnable runnable = mock(Runnable.class); sessionManager.submit(null, runnable); verify(executors).submit(runnable); }
@Test public void testSubmitWithTimer() { Runnable runnable = mock(Runnable.class); sessionManager.submit("test", runnable); ArgumentCaptor<SessionManager.RunnableWithTimer> arg = ArgumentCaptor .forClass(SessionManager.RunnableWithTimer.class); verify(executors).submit(arg.capture()); assertNotNull(arg.getValue().timer); assertSame(runnable, arg.getValue().task); }