@SuppressWarnings({ "rawtypes", "unchecked" })

@Test
public void testCapture() {
    boolean capture = snapshotManager.capture(new SimpleReplicatedLogEntry(9, 1,
            new MockRaftActorContext.MockPayload()), 9);
    assertTrue(capture);
    assertEquals(true, snapshotManager.isCapturing());
    ArgumentCaptor<Optional> outputStream = ArgumentCaptor.forClass(Optional.class);
    verify(mockProcedure).accept(outputStream.capture());
    assertEquals("isPresent", false, outputStream.getValue().isPresent());
    CaptureSnapshot captureSnapshot = snapshotManager.getCaptureSnapshot();
    // LastIndex and LastTerm are picked up from the lastLogEntry
    assertEquals(9L, captureSnapshot.getLastIndex());
    assertEquals(1L, captureSnapshot.getLastTerm());
    // Since the actor does not have any followers (no peer addresses) lastApplied will be from lastLogEntry
    assertEquals(9L, captureSnapshot.getLastAppliedIndex());
    assertEquals(1L, captureSnapshot.getLastAppliedTerm());
    //
    assertEquals(-1L, captureSnapshot.getReplicatedToAllIndex());
    assertEquals(-1L, captureSnapshot.getReplicatedToAllTerm());
    MessageCollectorActor.clearMessages(actorRef);
}