@Test public void returnsTheElectionTermAtAGivenSeqNum() throws Exception { havingLogged( entries() .term(17).seqNums(5, 6, 7) .term(18).seqNums(8, 9, 10)); assertThat(oracle.getTermAtSeqNum(4), is(equalTo(0L))); assertThat(oracle.getTermAtSeqNum(5), is(equalTo(17L))); assertThat(oracle.getTermAtSeqNum(10), is(equalTo(18L))); }
@Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); } }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig(); }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public long getTermAtSeqNum(long seqNum) { final Map.Entry<Long, Long> entry = termMap.floorEntry(seqNum); return entry == null ? 0 : entry.getValue(); }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig();  }