Using JUnit5 would help in that case: 
https://junit.org/junit5/docs/5.4.0-RC1/api/org/junit/jupiter/api/support/io/TempDirectory.html.
 Maybe it is time to upgrade…

> Am 27.01.2023 um 17:09 schrieb Julian Reschke <[email protected]>:
> 
> ...that is, when used with default settings.
> 
> Because, by default, it will not complain when files inside the
> temporary folder can not be removed - and that is usually the case when
> file handles were left open.
> 
> Yes, Unix and Linux can remove entries for open files, but that doesn't
> mean leaving files open is a good idea.
> 
> Please use
> 
>> @Rule
>>    public final TemporaryFolder temporaryFolder = 
>> TemporaryFolder.builder().assureDeletion().build();
> 
> instead. At least on Windows you'll see failures in these cases, and I
> consider that a feature (in this use case).
> 
> Best regards, Julian

Reply via email to