@Test
public void testCustomCallbackAfterPreparationAddMultipleWithIndex() throws Exception {

  DummyMainThread dummyMainThread = new DummyMainThread();
  try {
    testRunner.prepareSource();
    final TimelineGrabber timelineGrabber = new TimelineGrabber(testRunner);
    dummyMainThread.runOnMainThread(
        () ->
            mediaSource.addMediaSources(
                /* index */ 0,
                Arrays.asList(
                    new MediaSource[] {createFakeMediaSource(), createFakeMediaSource()}),
                new Handler(),
                timelineGrabber));
    Timeline timeline = timelineGrabber.assertTimelineChangeBlocking();
    assertThat(timeline.getWindowCount()).isEqualTo(2);
  } finally {
    dummyMainThread.release();
  }
}