library/core/src/test/java/com/google/android/exoplayer2/source/MergingMediaSourceTest.java
private static void testMergingMediaSourcePrepare(Timeline... timelines) throws IOException {
    FakeMediaSource[] mediaSources = new FakeMediaSource[timelines.length];
    for (int i = 0; i < timelines.length; i++) {
      mediaSources[i] = new FakeMediaSource(timelines[i], null);
    }
    MergingMediaSource mergingMediaSource = new MergingMediaSource(mediaSources);
    MediaSourceTestRunner testRunner = new MediaSourceTestRunner(mergingMediaSource, null);
    try {
      Timeline timeline = testRunner.prepareSource();
      // The merged timeline should always be the one from the first child.
      assertThat(timeline).isEqualTo(timelines[0]);
      testRunner.releaseSource();
      for (FakeMediaSource mediaSource : mediaSources) {
        mediaSource.assertReleased();
      }
    } finally {
      testRunner.release();
    }
  }
/**
   * Wraps the specified timelines in a {@link MergingMediaSource}, prepares it and checks that it
   * forwards the first of the wrapped timelines.
   */
Wraps the specified timelines in a  MergingMediaSource, prepares it and checks that it
forwards the first of the wrapped timelines.
Wraps the specified timelines in a MergingMediaSource prepares it and checks that it forwards the first of the wrapped timelines .
private static void testMergingMediaSourcePrepare(Timeline... timelines) throws IOException {
    FakeMediaSource[] mediaSources = new FakeMediaSource[timelines.length];
    for (int i = 0; i < timelines.length; i++) {
      mediaSources[i] = new FakeMediaSource(timelines[i], null);
    }
    MergingMediaSource mergingMediaSource = new MergingMediaSource(mediaSources);
    MediaSourceTestRunner testRunner = new MediaSourceTestRunner(mergingMediaSource, null);
    try {
      Timeline timeline = testRunner.prepareSource();
      assertThat(timeline).isEqualTo(timelines[0]);
      testRunner.releaseSource();
      for (FakeMediaSource mediaSource : mediaSources) {
        mediaSource.assertReleased();
      }
    } finally {
      testRunner.release();
    }
  }
private static void testMergingMediaSourcePrepare ( Timeline ... timelines ) throws IOException { FakeMediaSource [ ] mediaSources = new FakeMediaSource [ timelines . length ] ; for ( int i = 0 ; i < timelines . length ; i ++ ) { mediaSources [ i ] = new FakeMediaSource ( timelines [ i ] , null ) ; } MergingMediaSource mergingMediaSource = new MergingMediaSource ( mediaSources ) ; MediaSourceTestRunner testRunner = new MediaSourceTestRunner ( mergingMediaSource , null ) ; try { Timeline timeline = testRunner . prepareSource ( ) ; assertThat ( timeline ) . isEqualTo ( timelines [ 0 ] ) ; testRunner . releaseSource ( ) ; for ( FakeMediaSource mediaSource : mediaSources ) { mediaSource . assertReleased ( ) ; } } finally { testRunner . release ( ) ; } }
Wraps the specified timelines in a {@link MergingMediaSource}, prepares it and checks that it
 forwards the first of the wrapped timelines.
Wraps the specified timelines in a { @link MergingMediaSource } prepares it and checks that it forwards the first of the wrapped timelines .
// The merged timeline should always be the one from the first child.