+
+ @Test
+ public void testDecrNextIndex() {
+ MockRaftActorContext context = new MockRaftActorContext();
+ context.setCommitIndex(1);
+ FollowerLogInformation followerLogInformation =
+ new FollowerLogInformationImpl(new PeerInfo("follower1", null, VotingState.VOTING), 1, context);
+
+ assertTrue(followerLogInformation.decrNextIndex());
+ assertEquals("getNextIndex", 0, followerLogInformation.getNextIndex());
+
+ assertTrue(followerLogInformation.decrNextIndex());
+ assertEquals("getNextIndex", -1, followerLogInformation.getNextIndex());
+
+ assertFalse(followerLogInformation.decrNextIndex());
+ assertEquals("getNextIndex", -1, followerLogInformation.getNextIndex());
+ }