@Test
public void testAlreadyVotedForCandidate() {

    BaseState state = new EmptyState();
    RequestVote requestVote = RequestVote.newBuilder().setCandidateId(candidate.toString()).setLastLogIndex(2).setLastLogTerm(2).setTerm(2).build();
    when(mockRaftLog.lastVotedFor()).thenReturn(Optional.of(candidate));
    boolean shouldVote = state.shouldVoteFor(mockRaftLog, requestVote);
    assertTrue(shouldVote);
}