+ MessageCollectorActor.clearMessages(actorRef);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Test
+ public void testCaptureWithNullLastLogEntry() {
+ boolean capture = snapshotManager.capture(null, 1);
+
+ 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(0, captureSnapshot.getLastIndex());
+ assertEquals(0, captureSnapshot.getLastTerm());
+
+ // Since the actor does not have any followers (no peer addresses) lastApplied will be from lastLogEntry
+ assertEquals(0, captureSnapshot.getLastAppliedIndex());
+ assertEquals(0, captureSnapshot.getLastAppliedTerm());