DefaultPlaybackSessionManager implements PlaybackSessionManager { @Override public synchronized String getSessionForMediaPeriodId( Timeline timeline, MediaPeriodId mediaPeriodId) { int windowIndex = timeline.getPeriodByUid(mediaPeriodId.periodUid, period).windowIndex; return getOrAddSession(windowIndex, mediaPeriodId).sessionId; } DefaultPlaybackSessionManager(); @Override void setListener(Listener listener); @Override synchronized String getSessionForMediaPeriodId(
      Timeline timeline, MediaPeriodId mediaPeriodId); @Override synchronized boolean belongsToSession(EventTime eventTime, String sessionId); @Override synchronized void updateSessions(EventTime eventTime); @Override synchronized void handleTimelineUpdate(EventTime eventTime); @Override synchronized void handlePositionDiscontinuity(
      EventTime eventTime, @DiscontinuityReason int reason);  }
@Test public void getSessionForMediaPeriodId_returnsValue_butDoesNotCreateSession() { Timeline timeline = new FakeTimeline( 1); MediaPeriodId mediaPeriodId = new MediaPeriodId( timeline.getUidOfPeriod( 0), 0); String session = sessionManager.getSessionForMediaPeriodId(timeline, mediaPeriodId); assertThat(session).isNotEmpty(); verifyNoMoreInteractions(mockListener); }