public static LeaderInformationRegister clear(
            @Nullable LeaderInformationRegister leaderInformationRegister, String componentId) {
        if (leaderInformationRegister == null
                || !leaderInformationRegister.getRegisteredComponentIds().iterator().hasNext()) {
            return LeaderInformationRegister.empty();
        }

        return merge(leaderInformationRegister, componentId, LeaderInformation.empty());
    }
@Test
    void testClear() {
        final String componentId = "component-id";
        final LeaderInformation leaderInformation =
                LeaderInformation.known(UUID.randomUUID(), "address");

        final LeaderInformationRegister initialRegister =
                LeaderInformationRegister.of(componentId, leaderInformation);

        final LeaderInformationRegister newRegister =
                LeaderInformationRegister.clear(initialRegister, componentId);

        assertThat(newRegister).isNotSameAs(initialRegister);
        assertThat(newRegister.getRegisteredComponentIds()).isEmpty();
        assertThat(newRegister.forComponentId(componentId)).isNotPresent();
    }