### Question:
EncodedSequentialLog implements SequentialLog<E> { @Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } } EncodedSequentialLog(BytePersistence persistence,
                              SequentialEntryCodec<E> codec,
                              PersistenceNavigator persistenceNavigator); @Override void append(List<E> entries); @Override List<E> subSequence(long start, long end); @Override boolean isEmpty(); @Override E getLastEntry(); @Override SequentialEntryIterator<E> iterator(); @Override void truncate(long seqNum); @Override void sync(); @Override void close();  }### Answer:
@Test public void writesToTheSuppliedPersistenceObjectUsingTheSuppliedCodec() throws Exception { OLogEntry entry = makeEntry(seqNum(1), term(2), "data"); context.checking(new Expectations() {{ ignoring(navigator); allowing(persistence).size(); oneOf(codec).encode(with(equalTo(entry))); atLeast(1).of(persistence).append(with(any(ByteBuffer[].class))); }}); log.append(Lists.newArrayList(entry)); }
@Test public void notifiesTheNavigatorOnceForEveryEntryWritten() throws Exception { context.checking(new Expectations() {{ ignoring(codec); ignoring(persistence); exactly(5).of(navigator).notifyLogging(with(any(Long.class)), with(any(Long.class))); }}); log.append(nConsecutiveEntries(5)); }