@Override
    public void onLeaderInformationChange(String componentId, LeaderInformation leaderInformation) {
        synchronized (lock) {
            notifyLeaderInformationChangeInternal(
                    componentId,
                    leaderInformation,
                    confirmedLeaderInformation.forComponentIdOrEmpty(componentId));
        }
    }
@Test
    void testAllLeaderInformationChangeEventWithPartialCorrection() throws Exception {
        final AtomicReference<LeaderInformationRegister> storedLeaderInformation =
                new AtomicReference<>();
        new Context(storedLeaderInformation) {
            {
                runTestWithSynchronousEventHandling(
                        () -> {
                            final UUID leaderSessionID = UUID.randomUUID();
                            grantLeadership(leaderSessionID);

                            final LeaderInformationRegister correctLeaderInformationRegister =
                                    storedLeaderInformation.get();
                            assertThat(correctLeaderInformationRegister.getRegisteredComponentIds())
                                    .containsExactlyInAnyOrder(
                                            contenderContext0.componentId,
                                            contenderContext1.componentId);

                            // change LeaderInformation partially on external storage
                            final String componentIdWithChange = contenderContext0.componentId;
                            final String componentIdWithoutChange = contenderContext1.componentId;
                            final LeaderInformationRegister
                                    partiallyChangedLeaderInformationRegister =
                                            LeaderInformationRegister.clear(
                                                    correctLeaderInformationRegister,
                                                    componentIdWithChange);
                            storedLeaderInformation.set(partiallyChangedLeaderInformationRegister);
                            leaderElectionService.onLeaderInformationChange(
                                    partiallyChangedLeaderInformationRegister);

                            assertThat(
                                            storedLeaderInformation
                                                    .get()
                                                    .forComponentId(componentIdWithChange))
                                    .as("Removed leader information should have been reset.")
                                    .hasValue(
                                            correctLeaderInformationRegister.forComponentIdOrEmpty(
                                                    componentIdWithChange));

                            assertThat(
                                            storedLeaderInformation
                                                    .get()
                                                    .forComponentId(componentIdWithoutChange))
                                    .hasValue(
                                            correctLeaderInformationRegister.forComponentIdOrEmpty(
                                                    componentIdWithoutChange));
                        });
            }
        };
    }