package haya4.tools.files.compless; import static org.junit.Assert.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.junit.Test; public class UnZipTest { @Test public void uncompressTest() { Path testFile = Paths.get("target/test-classes/images.tar.gz"); Path outDir = Paths.get("target/test-classes/"); Path destDir = Paths.get("target/test-classes/images"); try { UnZip.uncompress(testFile, outDir); assertTrue(Files.exists(destDir)); assertTrue(Files.isDirectory(destDir)); boolean ret = UnZip.delete(destDir); assertTrue(ret); assertFalse(Files.exists(destDir)); } catch(Exception e) { fail(e.toString()); } } @Test public void decodeTest() { Path testFile = Paths.get("target/test-classes/images.zip"); Path destDir = Paths.get("target/test-classes/images"); try { UnZip.decode(testFile, "target/test-classes"); assertTrue(Files.exists(destDir)); assertTrue(Files.isDirectory(destDir)); boolean ret = UnZip.delete(destDir); assertTrue(ret); assertFalse(Files.exists(destDir)); } catch(Exception e) { fail(e.toString()); } } }