@Test
public void testTrimLogWhenTrimIndexNotPresent() {

    doReturn(20L).when(mockRaftActorContext).getLastApplied();
    doReturn(false).when(mockReplicatedLog).isPresent(10);
    long retIndex = snapshotManager.trimLog(10);
    assertEquals("return index", -1L, retIndex);
    verify(mockReplicatedLog, never()).snapshotPreCommit(anyLong(), anyLong());
    verify(mockReplicatedLog, never()).snapshotCommit();
    // Trim index is greater than replicatedToAllIndex so should update it.
    verify(mockRaftActorBehavior).setReplicatedToAllIndex(10L);
}