### Question:
SessionManager implements Closeable { public void deleteAsync(final String sessionId, final boolean expired) { Runnable task = new Runnable() { @Override public void run() { try { delete(sessionId, expired); } catch (Exception e) { logger.error("Exception occured while deleting sessionId '{}'", sessionId, e); } } }; submit("delete-async", 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();  }### Answer:
@Test public void testDeleteAsync() { sessionManager.deleteAsync("1", true); ArgumentCaptor<SessionManager.RunnableWithTimer> captor = ArgumentCaptor .forClass(SessionManager.RunnableWithTimer.class); verify(executors).submit(captor.capture()); assertNotNull(captor.getValue().timer); SessionData sessionData = new SessionData("1", now(), 10); RepositoryBackedSession session = mock(RepositoryBackedSession.class); when(repository.getSessionData("1")).thenReturn(sessionData); when(factory.build(sessionData)).thenReturn(session); captor.getValue().task.run(); verify(repository).getSessionData("1"); verify(factory).build(sessionData); verify(session).doInvalidate(true); }