### Question:
ProvenanceLog { static boolean needsCaching(ContentProvenance contentProvenance, File cacheDir) { boolean isCacheDir = ResourceUtil.isFileURI(contentProvenance.getSourceURI()) && StringUtils.startsWith(new File(contentProvenance.getSourceURI()).getAbsolutePath(), cacheDir.getAbsolutePath()); return !CacheLocalReadonly.isJarResource(contentProvenance.getLocalURI()) && !isCacheDir; }  static void appendProvenanceLog(File cacheDir, ContentProvenance contentProvenance); static File findProvenanceLogFile(String namespace, String cacheDir); static void parseProvenanceStream(InputStream is, ProvenanceEntryListener listener); final static String PROVENANCE_LOG_FILENAME; }### Answer:
@Test public void detectJarEntry() { ContentProvenance meta = new ContentProvenance( "some/namespace", URI.create("http: URI.create("jar:file: "1234", "1970-01-01"); assertFalse(ProvenanceLog.needsCaching(meta, tempDirectory)); }
@Test public void remoteURINeedsCaching() throws IOException, URISyntaxException { ContentProvenance meta = new ContentProvenance( "some/namespace", URI.create("http: new File(tempDirectory, "somefile.txt").toURI(), "1234", "1970-01-01"); assertTrue(ProvenanceLog.needsCaching(meta, tempDirectory)); }
@Test public void localURIOutsideOfCacheDirNeedsCaching() throws IOException, URISyntaxException { ContentProvenance meta = new ContentProvenance( "some/namespace", tempDirectory.getParentFile().toURI(), new File(tempDirectory, "somefile.txt").toURI(), "1234", "1970-01-01"); assertTrue(ProvenanceLog.needsCaching(meta, tempDirectory)); }
@Test public void localURIInsideOfCacheDirNeedsCaching() throws IOException, URISyntaxException { ContentProvenance meta = new ContentProvenance( "some/namespace", new File(tempDirectory, "somefile.txt").toURI(), new File(tempDirectory, "somefile.txt").toURI(), "1234", "1970-01-01"); assertFalse(ProvenanceLog.needsCaching(meta, tempDirectory)); }