### Question:
LogFileService implements LogPersistenceService<FilePersistence> { @Nullable @Override public FilePersistence getCurrent(String quorumId) throws IOException { final Path currentLink = getCurrentLink(quorumId); if (currentLink == null) { return null; } else { return new FilePersistence(Files.readSymbolicLink(currentLink)); } } LogFileService(Path basePath); @Nullable @Override FilePersistence getCurrent(String quorumId); @NotNull @Override FilePersistence create(String quorumId); @Override void append(String quorumId, @NotNull FilePersistence persistence); @Override void truncate(String quorumId); @Override ImmutableList<CheckedSupplier<FilePersistence, IOException>> getList(String quorumId); void clearAllLogs(); void archiveAllButCurrent(String quorumId);  }### Answer:
@Test public void appendsANewPersistenceSoThatItWillBeReturnedByFutureCallsToGetCurrent() throws Exception { final OLogHeader secondHeader; final long anArbitrarySeqNum = 1210; final long aGreaterArbitrarySeqNum = 1815; havingAppendedAPersistenceContainingHeader(anOLogHeaderWithSeqNum(anArbitrarySeqNum)); havingAppendedAPersistenceContainingHeader(secondHeader = anOLogHeaderWithSeqNum(aGreaterArbitrarySeqNum)); try (BytePersistence primaryPersistence = logFileService.getCurrent(QUORUM_ID)) { assertThat(deserializedHeader(primaryPersistence), is(equalToHeader(secondHeader))); } }
@Test public void returnsNullWhenCallingGetCurrentWhenThereAreNoLogs() throws Exception { assertThat(logFileService.getCurrent(QUORUM_ID), nullValue()); }
@Test public void returnsTheLatestAppendedPersistenceForAGivenQuorum() throws Exception { final OLogHeader header = anOLogHeader(); havingAppendedAPersistenceContainingHeader(header); try (BytePersistence persistence = logFileService.getCurrent(QUORUM_ID)) { assertThat(deserializedHeader(persistence), is(equalToHeader(header))); } }