@Test
  public void testTempFileEviction() throws IOException {
    when(mClock.now()).thenReturn(TimeUnit.DAYS.toMillis(1000));
    DefaultDiskStorage storage = getStorageSupplier(1).get();

    final String resourceId1 = "resource1";
    DiskStorage.Inserter inserter = storage.insert(resourceId1, null);
    final File tempFile = ((DefaultDiskStorage.InserterImpl) inserter).mTemporaryFile;

    // Make sure that we don't evict a recent temp file
    purgeUnexpectedFiles(storage);
    assertTrue(tempFile.exists());

    // Mark it old, then try eviction again. It should be gone.
    if (!tempFile.setLastModified(mClock.now() - DefaultDiskStorage.TEMP_FILE_LIFETIME_MS - 1000)) {
      throw new IOException("Unable to update timestamp of file: " + tempFile);
    }
    purgeUnexpectedFiles(storage);
    assertFalse(tempFile.exists());
  }
Inserts 3 files with different dates. Check what files are there. Uses an iterator to remove
the one in the middle. Check that later.

@throws Exception
imagepipeline-base/src/test/java/com/facebook/cache/disk/DefaultDiskStorageTest.java