### Question:
Manifest { Optional<String> fetch(final String assetName) { log.fine(() -> String.format("Fetching asset '%s'", assetName)); Optional<String> rv; try { final Map<String, String> values = getValues(); rv = Optional.ofNullable(values.get(assetName)).map(a -> a.replaceFirst("^/", "")); } catch (IOException e) { log.log(Level.WARNING, e, () -> String.format("Could not load manifestResource from %s", manifestResource)); rv = Optional.empty(); } if (!rv.isPresent()) { log.warning(() -> String.format("The asset '%s' was not in the manifestResource", assetName)); } return rv; } Manifest(final ObjectMapper objectMapper, final Resource manifestResource);   }### Answer:
@Test void fetchShouldWork() { final Manifest manifest = new Manifest(objectMapper, new ClassPathResource("fetchShouldWork.json")); assertThat(manifest.fetch("bums")).isEmpty(); assertThat(manifest.fetch("app.js")).contains("app-723a7d7a249d998465d650e19bdca289.js"); assertThat(manifest.fetch("app2.js")).contains("app2.js"); }
@Test void fetchShouldHandleBrokenManifest() { final Manifest manifest = new Manifest(objectMapper, new ClassPathResource("broken.json")); assertThat(manifest.fetch("app.js")).isEmpty(); }