@Test
public void testTrimLogWhenTrimIndexLessThanLastApplied() {

    doReturn(20L).when(mockRaftActorContext).getLastApplied();
    ReplicatedLogEntry replicatedLogEntry = mock(ReplicatedLogEntry.class);
    doReturn(true).when(mockReplicatedLog).isPresent(10);
    doReturn(replicatedLogEntry).when(mockReplicatedLog).get(10);
    doReturn(5L).when(replicatedLogEntry).getTerm();
    long retIndex = snapshotManager.trimLog(10);
    assertEquals("return index", 10L, retIndex);
    verify(mockReplicatedLog).snapshotPreCommit(10, 5);
    verify(mockReplicatedLog).snapshotCommit();
    verify(mockRaftActorBehavior, never()).setReplicatedToAllIndex(anyLong());
}