public void onNewLeaderElectionCompletion() {
    electionCount.inc();
    lastElectionTime = Timestamp.currentTime();
  }
@Test
  public void testOnLeaderElectionCompletion() throws Exception {
    leaderElectionMetrics.onNewLeaderElectionCompletion();
    final SortedMap<String, Gauge> gauges = ratisMetricRegistry.getGauges(
        (s, metric) -> s.contains(LAST_LEADER_ELECTION_ELAPSED_TIME));
    LOG.info("{} gauges: {}", LAST_LEADER_ELECTION_ELAPSED_TIME, gauges);
    final Long leaderElectionLatency = (Long)gauges.values().iterator().next().getValue();
    assertTrue(leaderElectionLatency >= 0L, "leaderElectionLatency = " + leaderElectionLatency);
  }