PersistedSessionManager implements SessionManager<T> { @Override public void clearSession(long id) { restoreAllSessionsIfNecessary(); if (activeSessionRef.get() != null && activeSessionRef.get().getId() == id) { synchronized (this) { activeSessionRef.set(null); activeSessionStorage.clear(); } } sessionMap.remove(id); final PreferenceStoreStrategy<T> storage = storageMap.remove(id); if (storage != null) { storage.clear(); } } PersistedSessionManager(PreferenceStore preferenceStore,
            SerializationStrategy<T> serializer, String prefKeyActiveSession,
            String prefKeySession);   PersistedSessionManager(PreferenceStore preferenceStore,
            SerializationStrategy<T> serializer, ConcurrentHashMap<Long, T> sessionMap,
            ConcurrentHashMap<Long, PreferenceStoreStrategy<T>> storageMap,
            PreferenceStoreStrategy<T> activesSessionStorage,
            String prefKeySession); @Override T getActiveSession(); @Override void setActiveSession(T session); @Override void clearActiveSession(); @Override T getSession(long id); @Override void setSession(long id, T session); @Override Map<Long, T> getSessionMap(); @Override void clearSession(long id);  }
@Test public void testClearSession() { final TwitterSession session = setupActiveSessionTest(); sessionManager.clearSession(session.getId()); assertMapSizes(0); assertNull(sessionManager.getActiveSession()); assertNull(sessionManager.getSession(session.getId())); }
@Test public void testClearSession_noSessions() { try { sessionManager.clearSession(TEST_SESSION_ID); } catch (Exception e) { fail(); } }