@Test
public void testGetCachedFromNonZeroPosition() {

  mockCache.contentLength = 1000;
  mockCache.spansAndGaps = new int[] {100, 100, 200};
  Pair<Long, Long> contentLengthAndBytesCached =
      CacheUtil.getCached(
          new DataSpec(
              Uri.parse("test"),
              /* absoluteStreamPosition= */ 100,
              /* length= */ C.LENGTH_UNSET,
              /* key= */ null),
          mockCache,
          /* cacheKeyFactory= */ null);
  assertThat(contentLengthAndBytesCached.first).isEqualTo(900);
  assertThat(contentLengthAndBytesCached.second).isEqualTo(200);
}