### Question:
LogEntry implements Checksum { @Override public long checksum() { long c = checksum(this.type.getNumber(), this.id.checksum()); c = checksumPeers(this.peers, c); c = checksumPeers(this.oldPeers, c); c = checksumPeers(this.learners, c); c = checksumPeers(this.oldLearners, c); if (this.data != null && this.data.hasRemaining()) { c = checksum(c, CrcUtil.crc64(this.data)); } return c; } LogEntry();  LogEntry(final EnumOutter.EntryType type); List<PeerId> getLearners(); void setLearners(final List<PeerId> learners); List<PeerId> getOldLearners(); void setOldLearners(final List<PeerId> oldLearners); boolean hasLearners(); @Override long checksum(); @SuppressWarnings("DeprecatedIsStillUsed") @Deprecated byte[] encode(); @SuppressWarnings("DeprecatedIsStillUsed") @Deprecated boolean decode(final byte[] content); boolean hasChecksum(); boolean isCorrupted(); long getChecksum(); void setChecksum(final long checksum); EnumOutter.EntryType getType(); void setType(final EnumOutter.EntryType type); LogId getId(); void setId(final LogId id); List<PeerId> getPeers(); void setPeers(final List<PeerId> peers); List<PeerId> getOldPeers(); void setOldPeers(final List<PeerId> oldPeers); ByteBuffer getData(); void setData(final ByteBuffer data); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }### Answer:
@Test public void testChecksum() { ByteBuffer buf = ByteBuffer.wrap("hello".getBytes()); LogEntry entry = new LogEntry(EnumOutter.EntryType.ENTRY_TYPE_NO_OP); entry.setId(new LogId(100, 3)); entry.setData(buf); entry.setPeers(Arrays.asList(new PeerId("localhost", 99, 1), new PeerId("localhost", 100, 2))); long c = entry.checksum(); assertTrue(c != 0); assertEquals(c, entry.checksum()); assertFalse(entry.isCorrupted()); assertFalse(entry.hasChecksum()); entry.setChecksum(c); assertTrue(entry.hasChecksum()); assertFalse(entry.isCorrupted()); entry.getId().setIndex(1); assertNotEquals(c, entry.checksum()); assertTrue(entry.isCorrupted()); entry.getId().setIndex(100); assertFalse(entry.isCorrupted()); entry.setData(ByteBuffer.wrap("hEllo".getBytes())); assertNotEquals(c, entry.checksum()); assertTrue(entry.isCorrupted()); }