DatastoreManager extends ManagerBase implements StoreManager { @Override public Session findSession(String id) throws IOException { log.debug("Datastore manager is loading session: " + id); Session session = null; try { session = this.getStore().load(id); } catch (ClassNotFoundException ex) { log.warn("An error occurred during session deserialization", ex); } return session; }  @Override Session findSession(String id); @Override void load(); @Override void unload(); @Override void removeSuper(Session session); @Override void remove(Session session); @Override int getActiveSessionsFull(); @Override Set<String> getSessionIdsFull(); @Override void processExpires(); Store getStore(); void setStore(Store store);  }
@Test public void testFindSession() throws IOException, ClassNotFoundException { when(store.load(anyString())).thenReturn(session); Session loaded = manager.findSession("123"); assertEquals(session, loaded); verify(store).load("123"); }
@Test public void testFindNonExistingSession() throws IOException { Session loaded = manager.findSession("123"); assertNull(loaded); }