@Test
public void testCustomCallbackBeforePreparationAddMultipleWithIndex() throws Exception {

  CountDownLatch runnableInvoked = new CountDownLatch(1);
  DummyMainThread dummyMainThread = new DummyMainThread();
  dummyMainThread.runOnMainThread(
      () ->
          mediaSource.addMediaSources(
              /* index */ 0,
              Arrays.asList(new MediaSource[] {createFakeMediaSource(), createFakeMediaSource()}),
              new Handler(),
              runnableInvoked::countDown));
  runnableInvoked.await(MediaSourceTestRunner.TIMEOUT_MS, TimeUnit.MILLISECONDS);
  dummyMainThread.release();
  assertThat(runnableInvoked.getCount()).isEqualTo(0);
}