Junit cannot delete @TempDir with file created by Spark Structured Streaming
问题 I created an integration test for my pipeline to check if the right CSV file is generated: class CsvBatchSinkTest { @RegisterExtension static SparkExtension spark = new SparkExtension(); @TempDir static Path directory; //this checks if the file is already available static boolean isFileWithSuffixAvailable(File directory, String suffix) throws IOException { return Files.walk(directory.toPath()).anyMatch(f -> f.toString().endsWith(suffix)); } //this gets content of file static List<String>