### Question:
CacheLocalReadonly implements Cache { @Override public ContentProvenance provenanceOf(URI resourceURI) { return getContentProvenance(resourceURI, this.cachePath, this.namespace); } CacheLocalReadonly(String namespace, String cachePath);  CacheLocalReadonly(String namespace, String cachePath, InputStreamFactory factory); @Override ContentProvenance provenanceOf(URI resourceURI); static ContentProvenance getContentProvenance(URI resourceURI, String cachePath, String namespace); static ContentProvenance getProvenance(URI resourceURI, String localArchiveSha256, URI sourceURI, String sha256, String accessedAt, File cacheDir, String namespace); static boolean inCachedArchive(String localArchiveSha256, String sha256); @Override InputStream retrieve(URI resourceURI);  }### Answer:
@Test public void resourceInCachedJar() throws URISyntaxException { String namespaceCacheDir = "/test-cache/globalbioticinteractions/template-dataset/"; URL resource = getClass().getResource(namespaceCacheDir + "access.tsv"); URL archive = getClass().getResource(namespaceCacheDir + "631d3777cf83e1abea848b59a6589c470cf0c7d0fd99682c4c104481ad9a543f"); String cacheDir = new File(resource.toURI()).getParentFile().getParentFile().getParent(); CacheLocalReadonly cacheLocalReadonly = new CacheLocalReadonly("globalbioticinteractions/template-dataset", cacheDir); ContentProvenance contentProvenance = cacheLocalReadonly.provenanceOf(URI.create("jar:" + archive.toString() + "!/globi.json")); assertThat(contentProvenance.getSourceURI().toString(), is("jar:https: assertThat(contentProvenance.getAccessedAt(), is("2017-09-14T16:39:33Z")); }
@Test public void remoteResource() throws URISyntaxException { String namespaceCacheDir = "/test-cache/globalbioticinteractions/template-dataset/"; URL resource = getClass().getResource(namespaceCacheDir + "access.tsv"); URL archiveURL = getClass().getResource(namespaceCacheDir + "631d3777cf83e1abea848b59a6589c470cf0c7d0fd99682c4c104481ad9a543f"); String cacheDir = new File(resource.toURI()).getParentFile().getParentFile().getParent(); CacheLocalReadonly cacheLocalReadonly = new CacheLocalReadonly("globalbioticinteractions/template-dataset", cacheDir); ContentProvenance contentProvenance = cacheLocalReadonly.provenanceOf(URI.create("https: assertThat(contentProvenance.getSourceURI().toString(), is("https: assertThat(contentProvenance.getAccessedAt(), is("2017-09-14T16:39:33Z")); assertThat(contentProvenance.getLocalURI(), is(archiveURL.toURI())); }