From 176937dea760e602d5fddd65b88d83974ed06a4b Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 15 Oct 2023 16:52:01 +0200 Subject: [PATCH] Simplify temp dir creation --- .../org/apache/maven/surefire/booter/ForkedBooterTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterTest.java index 515bee6b5a..2f047faf2e 100644 --- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterTest.java +++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterTest.java @@ -25,6 +25,7 @@ import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.ScheduledExecutorService; @@ -76,9 +77,7 @@ public void shouldNotBeDebugMode() throws Exception { @Test public void shouldReadSurefireProperties() throws Exception { - File target = new File(System.getProperty("user.dir", "target")); - File tmpDir = new File(target, "ForkedBooterTest.1"); - assertThat(tmpDir.mkdirs()).isTrue(); + File tmpDir = Files.createTempDirectory("ForkedBooterTest.1.").toFile(); try { try (InputStream is = invokeMethod(