()
| 93 | } |
| 94 | |
| 95 | @Test |
| 96 | void testCanUnzip() throws IOException { |
| 97 | File testZip = File.createTempFile("testUnzip", "zip"); |
| 98 | writeTestZip(testZip, 5, 10_000L); |
| 99 | File out = Zip.unzipToTempDir(new FileInputStream(testZip), "unzip", "stream"); |
| 100 | assertThat(out.list()).hasSize(5); |
| 101 | |
| 102 | assertThat(Arrays.stream(out.listFiles()).map(File::lastModified).collect(toSet())) |
| 103 | .as("Preserves original file's modification time when unzipping") |
| 104 | .containsExactlyInAnyOrder(0L, 10_000L, 20_000L, 30_000L, 40_000L); |
| 105 | } |
| 106 | |
| 107 | private void writeTestZip(File file, int files, long lastModifiedStep) throws IOException { |
| 108 | try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file))) { |
nothing calls this directly
no test coverage detected