@Test
  public void testStoreFile() throws Exception {
    DefaultDiskStorage storage = getStorageSupplier(1).get();
    final String resourceId1 = "resource1";
    final byte[] value1 = new byte[100];
    value1[80] = 101;
    File file1 = writeFileToStorage(storage, resourceId1, value1);

    Set<File> files = new HashSet<>();
    Assert.assertTrue(mDirectory.exists());
    List<File> founds1 = findNewFiles(mDirectory, files, /*recurse*/ true);
    Assert.assertNotNull(file1);
    Assert.assertTrue(founds1.contains(file1));
    Assert.assertTrue(file1.exists());
    assertEquals(100, file1.length());
    Assert.assertArrayEquals(value1, Files.toByteArray(file1));
  }
Test that a file is stored in a new file, and the bytes are stored plainly in the file.

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