public List<String> mergePartitions(
            MergingStrategy mergingStrategy,
            List<String> sourcePartitions,
            List<String> derivedPartitions) {

        if (!derivedPartitions.isEmpty()
                && !sourcePartitions.isEmpty()
                && mergingStrategy != MergingStrategy.EXCLUDING) {
            throw new ValidationException(
                    "The base table already has partitions defined. You might want to specify "
                            + "EXCLUDING PARTITIONS.");
        }

        if (!derivedPartitions.isEmpty()) {
            return derivedPartitions;
        }
        return sourcePartitions;
    }
@Test
    void mergeIncludingPartitionsFailsOnDuplicate() {
        List<String> sourcePartitions = Arrays.asList("col3", "col4");
        List<String> derivedPartitions = Arrays.asList("col1", "col2");

        assertThatThrownBy(
                        () ->
                                util.mergePartitions(
                                        MergingStrategy.INCLUDING,
                                        sourcePartitions,
                                        derivedPartitions))
                .isInstanceOf(ValidationException.class)
                .hasMessage(
                        "The base table already has partitions defined. You might want "
                                + "to specify EXCLUDING PARTITIONS.");
    }