@Test(expected = IOException.class) public void getURIRelativeWithFailedArchiveRetrieval() throws IOException { Cache cache = Mockito.mock(Cache.class); when(cache.retrieve(URI.create("some:bla/foo"))).thenReturn(IOUtils.toInputStream("relative", StandardCharsets.UTF_8)); DatasetImpl datasetUncached = new DatasetImpl("some/namespace", URI.create("some:bla"), inStream -> inStream); DatasetWithCache datasetWithCache = new DatasetWithCache(datasetUncached, cache); try { InputStream is = datasetWithCache.retrieve(URI.create("foo")); } catch (IOException ex) { assertThat(ex.getMessage(), is("failed to retrieve [some:bla]")); throw ex; } }
@Override public InputStream retrieve(URI resourceName) throws IOException { return cache.retrieve(resourceName); }
DatasetWithCache implements Dataset { @Override public InputStream retrieve(URI resourceName) throws IOException { return cache.retrieve(resourceName); } }
DatasetWithCache implements Dataset { @Override public InputStream retrieve(URI resourceName) throws IOException { return cache.retrieve(resourceName); } DatasetWithCache(Dataset dataset, final Cache cache); }
DatasetWithCache implements Dataset { @Override public InputStream retrieve(URI resourceName) throws IOException { return cache.retrieve(resourceName); } DatasetWithCache(Dataset dataset, final Cache cache); @Override InputStream retrieve(URI resourceName); URI getArchiveURI(); @Override String getOrDefault(String key, String defaultValue); String getNamespace(); JsonNode getConfig(); DOI getDOI(); String getCitation(); String getFormat(); URI getConfigURI(); @Override void setConfig(JsonNode config); @Override void setConfigURI(URI configURI); }
DatasetWithCache implements Dataset { @Override public InputStream retrieve(URI resourceName) throws IOException { return cache.retrieve(resourceName); } DatasetWithCache(Dataset dataset, final Cache cache); @Override InputStream retrieve(URI resourceName); URI getArchiveURI(); @Override String getOrDefault(String key, String defaultValue); String getNamespace(); JsonNode getConfig(); DOI getDOI(); String getCitation(); String getFormat(); URI getConfigURI(); @Override void setConfig(JsonNode config); @Override void setConfigURI(URI configURI);  }