public static void delete(File fileOrDir) throws IOException {
        if (fileOrDir == null) {
            return;
        }

        if (fileOrDir.isDirectory()) {
            cleanDirectory(fileOrDir);
        } else {
            if (fileOrDir.exists()) {
                boolean isDeleteOk = fileOrDir.delete();
                if (!isDeleteOk) {
                    throw new IOException("delete fail");
                }
            }
        }
    }
@Test
    public void testDelete() throws IOException {
        File deleteFile = new File(tempDir.toFile(), "delete.txt");
        deleteFile.createNewFile();
        Assert.assertTrue(deleteFile.exists());
        IoUtil.delete(deleteFile);
        Assert.assertFalse(deleteFile.exists());
        File deleteDir = new File(tempDir.toFile(), "delete");
        deleteDir.mkdirs();
        Assert.assertTrue(deleteDir.exists());
        File deleteDirFile = new File(deleteDir, "delete.txt");
        deleteDirFile.createNewFile();
        Assert.assertTrue(deleteDirFile.exists());
        IoUtil.delete(deleteDir);
        Assert.assertTrue(deleteDir.exists());
        Assert.assertFalse(deleteDirFile.exists());
    }