ZipEntryInput implements InputFile { public static InputFile forZipEntry(final ZipFile zip, final ZipEntry entry) { return forZipEntry(zip, entry, StandardCharsets.UTF_8); } private  ZipEntryInput(final ZipFile zip, final ZipEntry entry, final Charset charset); static InputFile forZipEntry(final ZipFile zip, final ZipEntry entry); static InputFile forZipEntry(final ZipFile zip, final ZipEntry entry,
            final Charset charset); @Override BufferedReader createReader(); @Override String getPath(); @Override boolean isRealFile(); @Override Path toPath(); @Override String toString();  }
@Test void testCreateZipEntryForDirNotSupportedThrowsException() throws IOException { try (final ZipFile zip = getZipFile()) { assertThrows(IllegalArgumentException.class, () -> ZipEntryInput.forZipEntry(zip, new ZipEntry("dir/"))); } }
@Test void testReadContentEntryDoesNotExistThrowsException() throws IOException { try (final ZipFile zip = getZipFile()) { final InputFile inputFile = ZipEntryInput.forZipEntry(zip, new ZipEntry("file")); assertThrows(ImporterException.class, () -> readContent(inputFile)); } }
@Test void testReadContentUtf8() throws IOException { addEntryToZip("file", CONTENT.getBytes(StandardCharsets.UTF_8)); try (final ZipFile zip = getZipFile()) { final InputFile inputFile = ZipEntryInput.forZipEntry(zip, new ZipEntry("file")); assertThat(readContent(inputFile), equalTo(CONTENT)); } }
@Test void testReadContentIso() throws IOException { addEntryToZip("file", CONTENT.getBytes(StandardCharsets.ISO_8859_1)); try (final ZipFile zip = getZipFile()) { final InputFile inputFile = ZipEntryInput.forZipEntry(zip, new ZipEntry("file"), StandardCharsets.ISO_8859_1); assertThat(readContent(inputFile), equalTo(CONTENT)); } }