private static void deleteAll(File file) throws IOException {
        // Use File#listFiles() instead of Files#list() to ignore files deleted by other threads during
        // iteration. See https://github.com/line/armeria/issues/4959
        if (file.isDirectory()) {
            final File[] files = file.listFiles();
            if (files == null) {
                return;
            }
            for (File child : files) {
                deleteAll(child);
            }
        }

        //noinspection ResultOfMethodCallIgnored
        file.delete();
    }
A helper class to handle temporary folders in JUnit {@code Extension}s.
testing-internal/src/main/java/com/linecorp/armeria/internal/testing/TemporaryFolder.java