@Override
    public void startLeaderElection(LeaderContender contender) throws Exception {
        Preconditions.checkNotNull(contender);
        parentService.register(componentId, contender);
    }
@Test
    void testContenderRegistration() throws Exception {
        final AtomicReference<String> componentIdRef = new AtomicReference<>();
        final AtomicReference<LeaderContender> contenderRef = new AtomicReference<>();
        final DefaultLeaderElection.ParentService parentService =
                TestingAbstractLeaderElectionService.newBuilder()
                        .setRegisterConsumer(
                                (actualComponentId, actualContender) -> {
                                    componentIdRef.set(actualComponentId);
                                    contenderRef.set(actualContender);
                                })
                        .build();
        try (final DefaultLeaderElection testInstance =
                new DefaultLeaderElection(parentService, DEFAULT_TEST_COMPONENT_ID)) {

            final LeaderContender contender = TestingGenericLeaderContender.newBuilder().build();
            testInstance.startLeaderElection(contender);

            assertThat(componentIdRef).hasValue(DEFAULT_TEST_COMPONENT_ID);
            assertThat(contenderRef.get()).isSameAs(contender);
        }
    }