Using @TempDir and giving -Djava.io.tmpdir=xxx #2987
-
Currently struggling a bit while using the following: Having the following test: class TempDirTest {
@Test
void testTempDir(@TempDir Path tmpdir) {
System.out.println("@TempDir : " + tmpdir);
System.out.println("java.io.tmpdir : " + System.getProperty("java.io.tmpdir"));
Path actual = tmpdir.getParent().toAbsolutePath();
Path expected = Path.of(System.getProperty("java.io.tmpdir"));
Assertions.assertEquals(expected, actual);
}
} If I run via:
within the following environment:
The given test succeeds.
The given test fails:
I've checked that with different combinations:
I have create a full working example which contains appropriate named branches for the different combinations. It looks like that the I've also tested the same combinations with JDK 17/11 from liberica with the same result. Also with JDK18 the test fails. Has someone observed something like that ? Or do I mistaken/overlook something here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After more checking I found out that via the standalone launcher, there is no problem at all. (no difference between jdk versions).
The output:
This looks like an issue in surefire/maven (I've created an appropriate issue https://issues.apache.org/jira/browse/SUREFIRE-2113). |
Beta Was this translation helpful? Give feedback.
After more checking I found out that via the standalone launcher, there is no problem at all. (no difference between jdk versions).
The output: