public Path createTempFile(String suffix) throws IOException {
        String actualSuffix = StringUtils.isBlank(suffix) ? ".tmp" : suffix;

        final Path path = tempFileDir == null ? Files.createTempFile("apache-tika-", actualSuffix) :
                Files.createTempFile(tempFileDir, "apache-tika-", actualSuffix);
        addResource(() -> {
            try {
                Files.delete(path);
            } catch (IOException e) {
                // delete when exit if current delete fail
                LOG.warn("delete tmp file fail, will delete it on exit");
                path.toFile().deleteOnExit();
            }
        });
        return path;
    }
@Test
    public void testFileDeletion() throws IOException {
        Path tempFile;
        try (TemporaryResources tempResources = new TemporaryResources()) {
            tempFile = tempResources.createTempFile();
            assertTrue(Files.exists(tempFile), "Temp file should exist while TempResources is used");
        }
        assertTrue(Files.notExists(tempFile),
                "Temp file should not exist after TempResources is closed");
    }