Skip to content

Commit

Permalink
fix test failures on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Dec 16, 2023
1 parent 4990bc1 commit 126273b
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.FileOutputStream;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.ZipEntry;
Expand All @@ -34,8 +35,6 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;

import com.google.common.io.Files;

import junit.framework.TestCase;


Expand Down Expand Up @@ -136,11 +135,12 @@ private void clean(File f)
public void testZipDirectory()
{
try {
File dir = Files.createTempDir();
final String prefix = "test_ome";
File dir = Files.createTempDirectory(prefix).toFile();
File f = File.createTempFile("testZipDirectory", ".tmp", dir);
File zip = IOUtil.zipDirectory(dir);
assertEquals(FilenameUtils.getExtension(zip.getName()), "zip");
File destDir = Files.createTempDir();
File destDir = Files.createTempDirectory(prefix).toFile();
boolean b = unzip(zip, destDir);
assertEquals(true, b);
File[] files = destDir.listFiles();
Expand All @@ -159,15 +159,16 @@ public void testZipDirectory()
public void testZipDirectoryWithSubfolder()
{
try {
File dir = Files.createTempDir();
final String prefix = "test_ome";
File dir = Files.createTempDirectory(prefix).toFile();
File f = File.createTempFile("testZipDirectoryWithSubfolder", ".tmp", dir);
File subfolder = Files.createTempDir();
File subfolder = Files.createTempDirectory(prefix).toFile();
File f1 = File.createTempFile("sub_testZipDirectoryWithSubfolder", ".tmp", subfolder);

FileUtils.moveDirectoryToDirectory(subfolder, dir, false);

File zip = IOUtil.zipDirectory(dir);
File destDir = Files.createTempDir();
File destDir = Files.createTempDirectory(prefix).toFile();
boolean b = unzip(zip, destDir);
assertEquals(true, b);
File[] files = destDir.listFiles();
Expand Down

0 comments on commit 126273b

Please sign in to comment.