1010import java .nio .file .Paths ;
1111import java .nio .file .attribute .PosixFilePermissions ;
1212import java .util .Properties ;
13+ import java .util .UUID ;
14+
1315import org .junit .jupiter .api .Test ;
1416
1517public class TempLocationManagerTest {
@@ -28,7 +30,7 @@ void testDefault() throws Exception {
2830
2931 @ Test
3032 void testFromConfig () throws Exception {
31- Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), "test1" );
33+ Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), UUID . randomUUID (). toString () );
3234 Files .createDirectories (myDir );
3335 Properties props = new Properties ();
3436 props .put (ProfilingConfig .PROFILING_TEMP_DIR , myDir .toString ());
@@ -41,7 +43,7 @@ void testFromConfig() throws Exception {
4143
4244 @ Test
4345 void testFromConfigInvalid () {
44- Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), "test2" );
46+ Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), UUID . randomUUID (). toString () );
4547 // do not create the directory - it should trigger an exception
4648 Properties props = new Properties ();
4749 props .put (ProfilingConfig .PROFILING_TEMP_DIR , myDir .toString ());
@@ -51,7 +53,7 @@ void testFromConfigInvalid() {
5153
5254 @ Test
5355 void testFromConfigNotWritable () throws Exception {
54- Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), "test3" );
56+ Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), UUID . randomUUID (). toString () );
5557 Files .createDirectories (
5658 myDir , PosixFilePermissions .asFileAttribute (PosixFilePermissions .fromString ("r-x------" )));
5759 Properties props = new Properties ();
@@ -63,7 +65,7 @@ void testFromConfigNotWritable() throws Exception {
6365
6466 @ Test
6567 void testCleanup () throws Exception {
66- Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), "test4" );
68+ Path myDir = Paths .get (System .getProperty ("java.io.tmpdir" ), UUID . randomUUID (). toString () );
6769 Files .createDirectories (myDir );
6870 Properties props = new Properties ();
6971 props .put (ProfilingConfig .PROFILING_TEMP_DIR , myDir .toString ());
0 commit comments