SessionDaoImpl implements SessionDao { @Override public void initSession(final String deviceId, final String contentUrl, final String contentName) { sessions.put(deviceId, new StreamingSession(contentName, contentUrl)); } SessionDaoImpl(); @Override void initSession(final String deviceId, final String contentUrl, final String contentName); @Override void updateSessionStatus(final String deviceId, final SessionStatus status); @Override void updateSessionPosition(final String deviceId, final Long position, final Long duration); @Override void removeDevice(final String deviceId); @Override StreamingSession getSession(final String deviceId); @Override Map<String, StreamingSession> getSessions();  }
@Test public void testInitSession() throws UnknownSessionException { SessionDaoImpl sessionDao = new SessionDaoImpl(); sessionDao.initSession("deviceId", "contentUrl", "contentName"); Map<String, StreamingSession> sessions = sessionDao.getSessions(); StreamingSession session = sessionDao.getSession("deviceId"); assertNotNull(sessions); assertEquals(1, sessions.size()); assertNotNull(session); assertEquals("contentUrl", session.getContentUrl()); assertEquals("contentName", session.getContentName()); assertTrue(session.getDuration() == 0l); assertTrue(session.getPosition() == 0l); assertTrue(session.getStatus() == WAITING); assertNotNull(session.toString()); }