diff --git a/src/test/java/net/smacke/jaydio/align/TestDirectIO.java b/src/test/java/net/smacke/jaydio/align/TestDirectIO.java index 2a12df9..4f93434 100644 --- a/src/test/java/net/smacke/jaydio/align/TestDirectIO.java +++ b/src/test/java/net/smacke/jaydio/align/TestDirectIO.java @@ -18,6 +18,7 @@ import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; +import java.nio.file.Files; import java.util.Arrays; import java.util.Random; @@ -63,12 +64,7 @@ public TestDirectIO() { } private static File getTempDirectory(String prefix, String suffix) throws IOException { - File temp = File.createTempFile(prefix, suffix); - if(!(temp.delete())) { - throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); - } else if (!temp.mkdir()) { - throw new IOException("could not create temporary directory"); - } + File temp = Files.createTempDirectory(prefix + suffix).toFile(); return temp; } diff --git a/src/test/java/net/smacke/jaydio/channel/TestDirectIoByteChannel.java b/src/test/java/net/smacke/jaydio/channel/TestDirectIoByteChannel.java index 2fbe5eb..6a97df3 100644 --- a/src/test/java/net/smacke/jaydio/channel/TestDirectIoByteChannel.java +++ b/src/test/java/net/smacke/jaydio/channel/TestDirectIoByteChannel.java @@ -18,6 +18,7 @@ import java.io.File; import java.io.IOException; import java.nio.channels.NonWritableChannelException; +import java.nio.file.Files; import java.util.Arrays; import net.smacke.jaydio.DirectIoLib; @@ -43,12 +44,7 @@ public class TestDirectIoByteChannel extends BufferedChannelAbstractTester