Skip to content

Commit

Permalink
Updated test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilerigila09 committed Sep 12, 2024
1 parent 8a6bdbf commit 7868762
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,13 @@ public static void main(String[] args) {
}

@Test
void shouldReExtractWhenUnpackedDirectoryIsMissing() throws InterruptedException {
CountDownLatch countDownLatch = new CountDownLatch(1);
AtomicInteger exceptionCounter = new AtomicInteger();
void shouldReExtractWhenUnpackedDirectoryIsMissing() throws IOException {
AtomicInteger extractCounter = new AtomicInteger();

try {
File narWorkingDirectory = NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, extractCounter::incrementAndGet);
FileUtils.deleteFile(narWorkingDirectory, true);
NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, extractCounter::incrementAndGet);
} catch (Exception e) {
log.error("Unpacking failed", e);
exceptionCounter.incrementAndGet();
} finally {
countDownLatch.countDown();
}
File narWorkingDirectory = NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, extractCounter::incrementAndGet);
FileUtils.deleteFile(narWorkingDirectory, true);
NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, extractCounter::incrementAndGet);

assertTrue(countDownLatch.await(30, TimeUnit.SECONDS));
assertEquals(exceptionCounter.get(), 0);
assertEquals(extractCounter.get(), 2);
}

Expand Down

0 comments on commit 7868762

Please sign in to comment.