DescriptorDigest getDigestFromFilename(Path layerFile) throws CacheCorruptedException {
    try {
      String hash = layerFile.getFileName().toString();
      return DescriptorDigest.fromHash(hash);

    } catch (DigestException | IndexOutOfBoundsException ex) {
      throw new CacheCorruptedException(
          cacheDirectory, "Layer file did not include valid hash: " + layerFile, ex);
    }
  }
@Test
  public void testGetDiffId() throws DigestException, CacheCorruptedException {
    Assert.assertEquals(
        DescriptorDigest.fromHash(
            "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"),
        TEST_CACHE_STORAGE_FILES.getDigestFromFilename(
            Paths.get(
                "layer",
                "file",
                "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")));
    Assert.assertEquals(
        DescriptorDigest.fromHash(
            "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
        TEST_CACHE_STORAGE_FILES.getDigestFromFilename(
            Paths.get("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")));
  }