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

        guardIfNotThreadSafe(FileUtils::deleteDirectoryInternal, directory);
    }
@Test
    void testDeleteDirectoryWhichIsAFile() throws Exception {

        // deleting a directory that is actually a file should fails

        File file = TempDirUtils.newFile(temporaryFolder);
        assertThatThrownBy(() -> FileUtils.deleteDirectory(file))
                .withFailMessage("this should fail with an exception")
                .isInstanceOf(IOException.class);
    }