Skip to content

Instantly share code, notes, and snippets.

@fge
Created April 13, 2015 22:51
Show Gist options
  • Save fge/c0801a33a67764368978 to your computer and use it in GitHub Desktop.
Save fge/c0801a33a67764368978 to your computer and use it in GitHub Desktop.
package com.github.fge;
import com.github.marschall.memoryfilesystem.MemoryFileSystemBuilder;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Map;
public final class ZipsTest
{
private FileSystem fs;
private Path existingZip;
private Path nonExistingZip;
@BeforeMethod
public void init()
throws IOException
{
fs = MemoryFileSystemBuilder.newLinux().build("zipstest");
existingZip = fs.getPath("/existing.zip");
nonExistingZip = fs.getPath("/nonexisting.zip");
final URI uri = URI.create("jar:" + existingZip);
final Map<String, ?> env = Collections.singletonMap("create", "true");
try (
final FileSystem tmp = FileSystems.newFileSystem(uri, env);
) {
}
}
@AfterMethod
public void closefs()
throws IOException
{
fs.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment