diff --git a/ugs-core/test/com/willwinder/universalgcodesender/utils/GcodeStreamTest.java b/ugs-core/test/com/willwinder/universalgcodesender/utils/GcodeStreamTest.java index 30d5cac51b..99c3acc8d9 100644 --- a/ugs-core/test/com/willwinder/universalgcodesender/utils/GcodeStreamTest.java +++ b/ugs-core/test/com/willwinder/universalgcodesender/utils/GcodeStreamTest.java @@ -21,6 +21,7 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.universalgcodesender.types.GcodeCommand; import java.io.*; +import java.nio.file.Files; import org.apache.commons.io.FileUtils; import org.junit.AfterClass; @@ -40,17 +41,7 @@ public static File createTempDirectory() throws IOException { final File temp; - temp = File.createTempFile("temp", Long.toString(System.nanoTime())); - - if(!(temp.delete())) - { - throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); - } - - if(!(temp.mkdir())) - { - throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); - } + temp = Files.createTempDirectory("temp" + Long.toString(System.nanoTime())).toFile(); return (temp); }