public void commitPartitions() throws Exception {
        commitPartitions((subtaskIndex, attemptNumber) -> true);
    }
@Test
    void testEmptyPartition() throws Exception {
        LinkedHashMap<String, String> staticPartitions = new LinkedHashMap<>();
        // add new empty partition
        staticPartitions.put("dt", "2022-08-02");
        FileSystemCommitter committer =
                new FileSystemCommitter(
                        fileSystemFactory,
                        metaStoreFactory,
                        true,
                        new Path(path.toString()),
                        1,
                        false,
                        identifier,
                        staticPartitions,
                        policies);

        createFile(path, "task-1-attempt-0/dt=2022-08-02/");
        createFile(path, "task-2-attempt-0/dt=2022-08-02/");

        committer.commitPartitions();

        File emptyPartitionFile = new File(outputPath.toFile(), "dt=2022-08-02");

        // assert partition dir is empty with only success file
        assertThat(emptyPartitionFile).exists();
        assertThat(emptyPartitionFile).isDirectory();
        assertThat(emptyPartitionFile).isNotEmptyDirectory();
        assertThat(emptyPartitionFile)
                .isDirectoryNotContaining(file -> !file.getName().equals(SUCCESS_FILE_NAME));

        // Add new empty partition to overwrite the old one with data
        createFile(outputPath, "dt=2022-08-02/f1");
        assertThat(new File(emptyPartitionFile, "f1")).exists();

        createFile(path, "task-1-attempt-0/dt=2022-08-02/");
        createFile(path, "task-2-attempt-0/dt=2022-08-02/");
        committer.commitPartitions();

        // assert partition dir is still empty because the partition dir is overwritten
        assertThat(emptyPartitionFile).exists();
        assertThat(emptyPartitionFile).isDirectory();
        assertThat(emptyPartitionFile).isNotEmptyDirectory();
        assertThat(emptyPartitionFile)
                .isDirectoryNotContaining(file -> !file.getName().equals(SUCCESS_FILE_NAME));

        // Add empty partition to the old one with data
        createFile(outputPath, "dt=2022-08-02/f1");
        assertThat(new File(emptyPartitionFile, "f1")).exists();

        createFile(path, "task-1-attempt-0/dt=2022-08-02/");
        createFile(path, "task-2-attempt-0/dt=2022-08-02/");
        committer =
                new FileSystemCommitter(
                        fileSystemFactory,
                        metaStoreFactory,
                        false,
                        new Path(path.toString()),
                        1,
                        false,
                        identifier,
                        staticPartitions,
                        policies);
        committer.commitPartitions();

        // assert the partition dir contains remaining 'f1' because overwrite is disabled
        assertThat(emptyPartitionFile).exists();
        assertThat(emptyPartitionFile).isDirectory();
        assertThat(emptyPartitionFile).isNotEmptyDirectory();
        assertThat(new File(emptyPartitionFile, "f1")).exists();
        assertThat(new File(emptyPartitionFile, SUCCESS_FILE_NAME)).exists();
    }