### Question:
ComposerJsonExtractor extends ComponentSupport { public Map<String, Object> extractFromZip(final Blob blob) throws IOException { try (InputStream is = blob.getInputStream()) { try (ArchiveInputStream ais = archiveStreamFactory.createArchiveInputStream(ArchiveStreamFactory.ZIP, is)) { ArchiveEntry entry = ais.getNextEntry(); while (entry != null) { Map<String, Object> contents = processEntry(ais, entry); if (!contents.isEmpty()) { return contents; } entry = ais.getNextEntry(); } } return Collections.emptyMap(); } catch (ArchiveException e) { throw new IOException("Error reading from archive", e); } }  Map<String, Object> extractFromZip(final Blob blob);  }### Answer:
@Test public void extractInfoFromZipballWithJson() throws Exception { String expected; try (InputStream in = getClass().getResourceAsStream("extractInfoFromZipballWithJson.composer.json")) { expected = CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8)); } String actual; try (InputStream in = getClass().getResourceAsStream("extractInfoFromZipballWithJson.zip")) { when(blob.getInputStream()).thenReturn(in); actual = new ObjectMapper().writeValueAsString(underTest.extractFromZip(blob)); } assertEquals(expected, actual, true); }
@Test public void extractInfoFromZipballWithJsonComposerArchived() throws Exception { String expected; try (InputStream in = getClass().getResourceAsStream("extractInfoFromZipballWithJsonComposerArchived.composer.json")) { expected = CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8)); } String actual; try (InputStream in = getClass().getResourceAsStream("extractInfoFromZipBallWithJsonComposerArchived.zip")) { when(blob.getInputStream()).thenReturn(in); actual = new ObjectMapper().writeValueAsString(underTest.extractFromZip(blob)); } assertEquals(expected, actual, true); }
@Test public void extractInfoFromZipballWithoutJson() throws Exception { Map<String, Object> results; try (InputStream in = getClass().getResourceAsStream("extractInfoFromZipballWithoutJson.zip")) { when(blob.getInputStream()).thenReturn(in); results = underTest.extractFromZip(blob); } assertThat(results.isEmpty(), is(true)); }