My project requires that I do not write to /tmp or whichever location it is when I use the TempDirectory extension. So right now I have no choice but to still use junit-pioneer's implementation, e.g. like this:
```java
@RegisterExtension
Extension tempDirectory = TempDirectory.createInCustomDirectory(() -> Paths.get("build"));
@BeforeEach
void setup(@TempDir Path testProjectDir) {
// Do something with "testProjectDir".
}
```
But it would be nicer if I could just use stock JUnit 5 for this. JUnit 4 supported setting the parent dir, so I find the JUnit 5 way a bit too limiting.
Thanks in advance.
Tentatively slated for 5.6 M2 solely for the purpose of _team discussion_
If your project requires you not to write to the default location of temporary files, you should set the java.io.tmpdir system property.
@rkrisztian Could you please try that?
Worked, thanks! I wish I knew about this. :)
Assigned to the general backlog and labeled as waiting for interest.
FYI: A co-worker of mine suggested the use of AbstractTask#getTemporaryDir():
tasks.withType(Test) {
systemProperty 'java.io.tmpdir', temporaryDir
}
I'm also interested in this functionality.
In my case I only want to affect the parent directory of one @TempDir and therefore it does not make sense to use java.io.tmpdir.
Most helpful comment
FYI: A co-worker of mine suggested the use of
AbstractTask#getTemporaryDir():