@Test
public void testCacheLengthExceedsActualDataLength() throws Exception {

  FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
  FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
  Uri testUri = Uri.parse("test_data");
  DataSpec dataSpec = new DataSpec(testUri, 0, 1000, null);
  CachingCounters counters = new CachingCounters();
  CacheUtil.cache(
      dataSpec, cache, /* cacheKeyFactory= */ null, dataSource, counters, /* isCanceled= */ null);
  counters.assertValues(0, 100, 1000);
  assertCachedData(cache, fakeDataSet);
}