diff --git a/src/test/java/jnr/posix/windows/WindowsFileTest.java b/src/test/java/jnr/posix/windows/WindowsFileTest.java index 15910f9f..1f540ef1 100644 --- a/src/test/java/jnr/posix/windows/WindowsFileTest.java +++ b/src/test/java/jnr/posix/windows/WindowsFileTest.java @@ -2,7 +2,8 @@ import java.io.File; import java.io.IOException; -import java.io.RandomAccessFile; +import java.io.RandomAccessFile; +import java.nio.file.Files; import java.text.NumberFormat; import jnr.posix.DummyPOSIXHandler; import jnr.posix.FileStat; @@ -15,8 +16,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - +import static org.junit.Assert.assertTrue; + public class WindowsFileTest { private static POSIX posix; @@ -52,9 +53,7 @@ public void cleanup(File node) { // FIXME: This is a broken method since it does not delete any of the generated dirs. private static final String DIR_NAME = "0123456789"; private Pair makeLongPath() throws IOException { - File tmp = File.createTempFile("temp", Long.toHexString(System.nanoTime())); - - if (!(tmp.delete() && tmp.mkdir())) throw new IOException("Could not make a long path"); + File tmp = Files.createTempDirectory("temp" + Long.toHexString(System.nanoTime())).toFile(); StringBuilder buf = new StringBuilder(DIR_NAME); for (int i = 0; i < 30; i++) {