### Question:
CacheStorageFiles { Path getImageDirectory(ImageReference imageReference) { String replacedReference = imageReference.toStringWithQualifier().replace(':', '!').replace('@', '!'); Iterable<String> directories = Splitter.on('/').split(replacedReference); Path destination = getImagesDirectory(); for (String dir : directories) { destination = destination.resolve(dir); } return destination; } CacheStorageFiles(Path cacheDirectory);   }### Answer:
@Test public void testGetImageDirectory() throws InvalidImageReferenceException { Path imagesDirectory = Paths.get("cache", "directory", "images"); Assert.assertEquals(imagesDirectory, TEST_CACHE_STORAGE_FILES.getImagesDirectory()); Assert.assertEquals( imagesDirectory.resolve("reg.istry/repo/sitory!tag"), TEST_CACHE_STORAGE_FILES.getImageDirectory( ImageReference.parse("reg.istry/repo/sitory:tag"))); Assert.assertEquals( imagesDirectory.resolve( "reg.istry/repo!sha256!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), TEST_CACHE_STORAGE_FILES.getImageDirectory( ImageReference.parse( "reg.istry/repo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))); Assert.assertEquals( imagesDirectory.resolve("reg.istry!5000/repo/sitory!tag"), TEST_CACHE_STORAGE_FILES.getImageDirectory( ImageReference.parse("reg.istry:5000/repo/sitory:tag"))); }