SessionDaoImpl implements SessionDao { @Override public StreamingSession getSession(final String deviceId) throws UnknownSessionException { return Optional.ofNullable(sessions.get(deviceId)).orElseThrow(() -> new UnknownSessionException(deviceId)); } 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(expected = UnknownSessionException.class) public void testGetUnknownSession() throws UnknownSessionException { SessionDaoImpl sessionDao = new SessionDaoImpl(); sessionDao.getSession("deviceId"); }