@Test void isLeaderAndIsLeaderShouldReturnTrue() { final LeaderElectionConfig lec = mock(LeaderElectionConfig.class, Answers.RETURNS_DEEP_STUBS); when(lec.getLock().identity()).thenReturn("1337"); final LeaderElectionRecord ler = mock(LeaderElectionRecord.class); when(ler.getHolderIdentity()).thenReturn("1337"); final boolean result = new LeaderElector<>(mock(DefaultKubernetesClient.class), lec).isLeader(ler); assertTrue(result); }
protected final boolean isLeader(LeaderElectionRecord leaderElectionRecord) { return Objects.equals(leaderElectionConfig.getLock().identity(), leaderElectionRecord.getHolderIdentity()); }
LeaderElector { protected final boolean isLeader(LeaderElectionRecord leaderElectionRecord) { return Objects.equals(leaderElectionConfig.getLock().identity(), leaderElectionRecord.getHolderIdentity()); } }
LeaderElector { protected final boolean isLeader(LeaderElectionRecord leaderElectionRecord) { return Objects.equals(leaderElectionConfig.getLock().identity(), leaderElectionRecord.getHolderIdentity()); } LeaderElector(C kubernetesClient, LeaderElectionConfig leaderElectionConfig); }
LeaderElector { protected final boolean isLeader(LeaderElectionRecord leaderElectionRecord) { return Objects.equals(leaderElectionConfig.getLock().identity(), leaderElectionRecord.getHolderIdentity()); } LeaderElector(C kubernetesClient, LeaderElectionConfig leaderElectionConfig); void run(); }
LeaderElector { protected final boolean isLeader(LeaderElectionRecord leaderElectionRecord) { return Objects.equals(leaderElectionConfig.getLock().identity(), leaderElectionRecord.getHolderIdentity()); } LeaderElector(C kubernetesClient, LeaderElectionConfig leaderElectionConfig); void run();  }