public static void deleteDirectory(File directory) throws IOException {
        checkNotNull(directory, "directory");

        guardIfNotThreadSafe(FileUtils::deleteDirectoryInternal, directory);
    }
@Tag("org.apache.flink.testutils.junit.FailsInGHAContainerWithRootUser")
    @Test
    void testDeleteProtectedDirectory() throws Exception {
        // deleting a write protected file should throw an error

        File cannotDeleteParent = TempDirUtils.newFolder(temporaryFolder);
        File cannotDeleteChild = new File(cannotDeleteParent, "child");

        try {
            assumeThat(cannotDeleteChild.createNewFile()).isTrue();
            assumeThat(cannotDeleteParent.setWritable(false)).isTrue();
            assumeThat(cannotDeleteChild.setWritable(false)).isTrue();
            assertThatThrownBy(() -> FileUtils.deleteDirectory(cannotDeleteParent))
                    .isInstanceOf(AccessDeniedException.class);
        } finally {
            //noinspection ResultOfMethodCallIgnored
            cannotDeleteParent.setWritable(true);
            //noinspection ResultOfMethodCallIgnored
            cannotDeleteChild.setWritable(true);
        }
    }