LeaderElectorBuilder { public LeaderElector<C> build() { return new LeaderElector<>(client, leaderElectionConfig); } LeaderElectorBuilder(C client); LeaderElectorBuilder<C> withConfig(LeaderElectionConfig leaderElectionConfig); LeaderElector<C> build();  }
@Test void withConfigAndMissingNameShouldThrowException() { assertRequiredField(defaultConfigBuilder.withName(null).build()); }
@Test void withConfigAndMissingLeaseDurationShouldThrowException() { assertRequiredField(defaultConfigBuilder.withLeaseDuration(null).build()); }
@Test void withConfigAndMissingRenewDeadlineShouldThrowException() { assertRequiredField(defaultConfigBuilder.withRenewDeadline(null).build()); }
@Test void withConfigAndMissingRetryPeriodShouldThrowException() { assertRequiredField(defaultConfigBuilder.withRetryPeriod(null).build()); }
@Test void withConfigAndMissingLeaderCallbacksPeriodShouldThrowException() { assertRequiredField(defaultConfigBuilder.withLeaderCallbacks(null).build()); }
@Test void withConfigAndMissingLockPeriodShouldThrowException() { assertRequiredField(defaultConfigBuilder.withLock(null).build()); }
@Test void withConfigAndInvalidLeaseDurationComparedToRenewDeadlineShouldThrowException() { assertInvalidField(defaultConfigBuilder .withLeaseDuration(Duration.ofSeconds(1)).withRenewDeadline(Duration.ofSeconds(2)).build() ); }
@Test void withConfigAndInvalidRenewDeadlineComparedToRetryPeriodShouldThrowException() { assertInvalidField(defaultConfigBuilder .withRenewDeadline(Duration.ofSeconds(1)).withRetryPeriod(Duration.ofMillis(8000L)).build() ); }
@Test void withConfigAndInvalidLeaseDurationShouldThrowException() { assertInvalidField(defaultConfigBuilder .withLeaseDuration(Duration.ofNanos(15)) .withRenewDeadline(Duration.ofNanos(10)) .withRetryPeriod(Duration.ofNanos(2)) .build() ); }
@Test void withConfigAndInvalidRenewDeadlineShouldThrowException() { assertInvalidField(defaultConfigBuilder .withRenewDeadline(Duration.ofNanos(10)) .withRetryPeriod(Duration.ofNanos(2)) .build() ); }
@Test void withConfigAndInvalidRetryPeriodShouldThrowException() { assertInvalidField(defaultConfigBuilder.withRetryPeriod(Duration.ofNanos(2)).build()); }