SessionManager { public ListMultimap<Long, String> getSessions() { return sessionUsers; }  boolean isSessionActive(final Long sessionId); Long createSession(); void registerEstimate(final Long sessionID, final Estimate estimate); List<Estimate> getResults(final Long sessionId); List<String> getSessionUsers(final Long sessionId); ListMultimap<Long, String> getSessions(); synchronized void clearSessions(); void resetSession(final Long sessionId); void registerUser(final String userName, final Long sessionId); void removeUser(String userName, Long sessionId); static final Long SESSION_SEQ_START_VALUE; }
@Test public void testGetSessions() throws Exception { final Long sessionOne = sessionManager.createSession(); final Long sessionTwo = sessionManager.createSession(); final ArrayList<String> sessionOneUsers = Lists.newArrayList("Rich", "Helen", "Tim"); final ArrayList<String> sessionTwoUsers = Lists.newArrayList("Jan", "Toby", "Dani"); final ListMultimap<Long, String> expected = ArrayListMultimap.create(); for (String user : sessionOneUsers) { expected.put(sessionOne, user); } for (String user : sessionTwoUsers) { expected.put(sessionTwo, user); } final ListMultimap<Long, String> sessions = sessionManager.getSessions(); registerUsers(sessionOne, sessionOneUsers); registerUsers(sessionTwo, sessionTwoUsers); assertEquals(expected, sessions); }