@Test
public void testSnapshotPreCommit() {

    //add 4 more entries
    replicatedLogImpl.append(new SimpleReplicatedLogEntry(4, 2, new MockPayload("E")));
    replicatedLogImpl.append(new SimpleReplicatedLogEntry(5, 2, new MockPayload("F")));
    replicatedLogImpl.append(new SimpleReplicatedLogEntry(6, 3, new MockPayload("G")));
    replicatedLogImpl.append(new SimpleReplicatedLogEntry(7, 3, new MockPayload("H")));
    //sending negative values should not cause any changes
    replicatedLogImpl.snapshotPreCommit(-1, -1);
    assertEquals(8, replicatedLogImpl.size());
    assertEquals(-1, replicatedLogImpl.getSnapshotIndex());
    assertEquals(-1, replicatedLogImpl.getSnapshotTerm());
    replicatedLogImpl.snapshotPreCommit(4, 2);
    assertEquals(3, replicatedLogImpl.size());
    assertEquals(4, replicatedLogImpl.getSnapshotIndex());
    assertEquals(2, replicatedLogImpl.getSnapshotTerm());
    replicatedLogImpl.snapshotPreCommit(6, 3);
    assertEquals(1, replicatedLogImpl.size());
    assertEquals(6, replicatedLogImpl.getSnapshotIndex());
    assertEquals(3, replicatedLogImpl.getSnapshotTerm());
    replicatedLogImpl.snapshotPreCommit(7, 3);
    assertEquals(0, replicatedLogImpl.size());
    assertEquals(7, replicatedLogImpl.getSnapshotIndex());
    assertEquals(3, replicatedLogImpl.getSnapshotTerm());
    //running it again on an empty list should not throw exception
    replicatedLogImpl.snapshotPreCommit(7, 3);
    assertEquals(0, replicatedLogImpl.size());
    assertEquals(7, replicatedLogImpl.getSnapshotIndex());
    assertEquals(3, replicatedLogImpl.getSnapshotTerm());
}