### Question:
OLogShim implements Syncable, HLog { @Override public void sync(long txid) throws IOException { this.sync(); } OLogShim(GeneralizedReplicator replicator); @Override Long startCacheFlush(byte[] encodedRegionName); @Override void completeCacheFlush(byte[] encodedRegionName); @Override void abortCacheFlush(byte[] encodedRegionName); @Override boolean isLowReplicationRollEnabled(); @Override long getEarliestMemstoreSeqNum(byte[] encodedRegionName); @Override void registerWALActionsListener(WALActionsListener listener); @Override boolean unregisterWALActionsListener(WALActionsListener listener); @Override WALCoprocessorHost getCoprocessorHost(); @Override byte[][] rollWriter(); @Override byte[][] rollWriter(boolean force); @Override void close(); @Override void closeAndDelete(); @Override void hflush(); @Override void hsync(); @Override void sync(long txid); @Override void sync(); @Override long getSequenceNumber(); @Override // TODO this is a problematic call because the replication algorithm is in charge of the log-ids. We must // TODO deprecate this call, and bubble the consequences throughout the system. void setSequenceNumber(long newValue); @Override long obtainSeqNum(); @Override void append(HRegionInfo info,
                     TableName tableName,
                     WALEdit edits,
                     long now,
                     HTableDescriptor htd); @Override void append(HRegionInfo info,
                     TableName tableName,
                     WALEdit edits,
                     long now,
                     HTableDescriptor htd,
                     boolean isInMemstore); @Override long appendNoSync(HRegionInfo info,
                           TableName tableName,
                           WALEdit edit, List<UUID> clusterIds,
                           long now,
                           HTableDescriptor htd); @Override long getFilenum();  }### Answer:
@Test(expected = IOException.class, timeout = 3000) public void syncThrowsAnExceptionIfTheReplicatorIsUnableToReplicateTheData() throws Exception { havingAppendedAndReceivedResponse(hLog, aFailureResponseWithSeqNum(1)); hLog.sync(); }
@Test(timeout = 3000) public void syncCanWaitForSeveralPrecedingLogAppends() throws Exception { havingAppendedAndReceivedResponse(hLog, aSuccessResponseWithSeqNum(1)); havingAppendedAndReceivedResponse(hLog, aSuccessResponseWithSeqNum(2)); havingAppendedAndReceivedResponse(hLog, aSuccessResponseWithSeqNum(3)); hLog.sync(); }