### Question:
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();  }### Answer:
@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))); }
@Test public void handlesTruncationsAndUpdatesTermInformationAccordingly() throws Exception { havingLogged( entries() .term(7).seqNums(1, 2)); havingTruncatedToSeqNum(2); havingLogged( entries() .term(8).seqNums(2)); assertThat(oracle.getTermAtSeqNum(1), is(equalTo(7L))); assertThat(oracle.getTermAtSeqNum(2), is(equalTo(8L))); }