### Question:
CompositeSequenceableLoader implements SequenceableLoader { @Override public final long getNextLoadPositionUs() { long nextLoadPositionUs = Long.MAX_VALUE; for (SequenceableLoader loader : loaders) { long loaderNextLoadPositionUs = loader.getNextLoadPositionUs(); if (loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE) { nextLoadPositionUs = Math.min(nextLoadPositionUs, loaderNextLoadPositionUs); } } return nextLoadPositionUs == Long.MAX_VALUE ? C.TIME_END_OF_SOURCE : nextLoadPositionUs; } CompositeSequenceableLoader(SequenceableLoader[] loaders); @Override final long getBufferedPositionUs(); @Override final long getNextLoadPositionUs(); @Override final void reevaluateBuffer(long positionUs); @Override boolean continueLoading(long positionUs);  }### Answer:
@Test public void testGetNextLoadPositionUsReturnMinimumLoaderNextLoadPositionUs() { FakeSequenceableLoader loader1 = new FakeSequenceableLoader( 1000, 2001); FakeSequenceableLoader loader2 = new FakeSequenceableLoader( 1001, 2000); CompositeSequenceableLoader compositeSequenceableLoader = new CompositeSequenceableLoader( new SequenceableLoader[] {loader1, loader2}); assertThat(compositeSequenceableLoader.getNextLoadPositionUs()).isEqualTo(2000); }
@Test public void testGetNextLoadPositionUsReturnMinimumNonEndOfSourceLoaderNextLoadPositionUs() { FakeSequenceableLoader loader1 = new FakeSequenceableLoader( 1000, 2000); FakeSequenceableLoader loader2 = new FakeSequenceableLoader( 1001, 2001); FakeSequenceableLoader loader3 = new FakeSequenceableLoader( 1001, C.TIME_END_OF_SOURCE); CompositeSequenceableLoader compositeSequenceableLoader = new CompositeSequenceableLoader( new SequenceableLoader[] {loader1, loader2, loader3}); assertThat(compositeSequenceableLoader.getNextLoadPositionUs()).isEqualTo(2000); }
@Test public void testGetNextLoadPositionUsReturnsEndOfSourceWhenAllLoaderLoadingLastChunk() { FakeSequenceableLoader loader1 = new FakeSequenceableLoader( 1000, C.TIME_END_OF_SOURCE); FakeSequenceableLoader loader2 = new FakeSequenceableLoader( 1001, C.TIME_END_OF_SOURCE); CompositeSequenceableLoader compositeSequenceableLoader = new CompositeSequenceableLoader( new SequenceableLoader[] {loader1, loader2}); assertThat(compositeSequenceableLoader.getNextLoadPositionUs()).isEqualTo(C.TIME_END_OF_SOURCE); }