RFR: 7903953: Use scratch directory for JUnit's TempDir annotation

Christian Stein cstein at openjdk.org
Mon Feb 24 11:31:10 UTC 2025


On Mon, 24 Feb 2025 11:22:22 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> test/junitTrace/JupiterTempDir.java line 39:
>> 
>>> 37: class JupiterTempDir {
>>> 38:     @Test
>>> 39:     @EnabledIfSystemProperty(named = "test.name", matches = "JupiterTempDir.java")
>> 
>> Hello Christian, why is this needed in this test?
>
> The assertion(s) in the test only make sense, when `jtreg` runs the test via its `JUnitRunner`. The `test.name` system property is an indicator that `jtreg` runs the test, I could switch to another one documented here: https://openjdk.org/jtreg/tag-spec.html#testvars

Perhaps it would be better to replace this non-obvious declarative guard with a programmatic `Assumptions....` statement within the test method. 🤔

-------------

PR Review Comment: https://git.openjdk.org/jtreg/pull/248#discussion_r1967465490


More information about the jtreg-dev mailing list