### Question:
ClasspathDigester { public Serializable digest(List<Artifact> artifacts) throws IOException { MessageDigest digester = SHA1Digester.newInstance(); for (Artifact artifact : artifacts) { File file = artifact.getFile(); String cacheKey = getArtifactKey(artifact); byte[] cached = cache.get(cacheKey); if (cached == null) { byte[] hash; if (file.isFile()) { hash = new JarDigester(file).call(); } else if (file.isDirectory()) { hash = new ClassDirectoryDigester(file).call(); } else { hash = new byte[0]; } cached = cache.putIfAbsent(cacheKey, hash); if (cached == null) { cached = hash; } } digester.update(cached); } return new BytesHash(digester.digest()); } @Inject  ClasspathDigester(MavenSession session);   ClasspathDigester(ConcurrentMap<String, byte[]> cache); Serializable digest(List<Artifact> artifacts);  }### Answer:
@Test public void testEntryCache() throws Exception { ClasspathDigester digester = new ClasspathDigester(new ConcurrentHashMap<String, byte[]>()); ArtifactHandler handler = new DefaultArtifactHandler("jar"); Artifact a = new DefaultArtifact("g", "a", "1", Artifact.SCOPE_COMPILE, "jar", null, handler); a.setFile(new File("src/test/projects/digester")); Serializable cached = digester.digest(Collections.singletonList(a)); Serializable digest = digester.digest(Collections.singletonList(a)); Assert.assertTrue(digest.equals(cached)); }