@Test
public void testCustomCallbackAfterPreparationAddSingleWithIndex() throws Exception {

  DummyMainThread dummyMainThread = new DummyMainThread();
  try {
    testRunner.prepareSource();
    final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner);
    dummyMainThread.runOnMainThread(
        () ->
            mediaSource.addMediaSource(
                /* index */ 0, createFakeMediaSource(), new Handler(), timelineGrabber));
    Timeline timeline = timelineGrabber.assertTimelineChangeBlocking();
    assertThat(timeline.getWindowCount()).isEqualTo(1);
  } finally {
    dummyMainThread.release();
  }
}