import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@Test
public void testCaptureWithCreateProcedureError() {
- doThrow(new RuntimeException("mock")).when(mockProcedure).accept(anyObject());
+ doThrow(new RuntimeException("mock")).when(mockProcedure).accept(any());
boolean capture = snapshotManager.capture(new SimpleReplicatedLogEntry(9, 1,
new MockRaftActorContext.MockPayload()), 9);
assertEquals(false, snapshotManager.isCapturing());
- verify(mockProcedure).accept(anyObject());
+ verify(mockProcedure).accept(any());
}
@SuppressWarnings("unchecked")
assertTrue(capture);
- verify(mockProcedure).accept(anyObject());
+ verify(mockProcedure).accept(any());
reset(mockProcedure);
assertFalse(capture);
- verify(mockProcedure, never()).accept(anyObject());
+ verify(mockProcedure, never()).accept(any());
}
@Test
@Test
public void testPersistSendInstallSnapshot() throws Exception {
doReturn(Integer.MAX_VALUE).when(mockReplicatedLog).dataSize();
- doNothing().when(mockProcedure).accept(anyObject());
+ doNothing().when(mockProcedure).accept(any());
// when replicatedToAllIndex = -1
boolean capture = snapshotManager.captureToInstall(new SimpleReplicatedLogEntry(9, 6,