@Test public void testGetState() { CandidateNodeRole role = new CandidateNodeRole(1, 2, ElectionTimeout.NONE); RoleState state = role.getState(); Assert.assertEquals(RoleName.CANDIDATE, state.getRoleName()); Assert.assertEquals(1, state.getTerm()); Assert.assertEquals(2, state.getVotesCount()); }
@Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.CANDIDATE, term); state.setVotesCount(votesCount); return state; }
CandidateNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.CANDIDATE, term); state.setVotesCount(votesCount); return state; } }
CandidateNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.CANDIDATE, term); state.setVotesCount(votesCount); return state; } CandidateNodeRole(int term, ElectionTimeout electionTimeout);  CandidateNodeRole(int term, int votesCount, ElectionTimeout electionTimeout); }
CandidateNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.CANDIDATE, term); state.setVotesCount(votesCount); return state; } CandidateNodeRole(int term, ElectionTimeout electionTimeout);  CandidateNodeRole(int term, int votesCount, ElectionTimeout electionTimeout); int getVotesCount(); @Override NodeId getLeaderId(NodeId selfId); @Override void cancelTimeoutOrTask(); @Override RoleState getState(); @Override String toString(); }
CandidateNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.CANDIDATE, term); state.setVotesCount(votesCount); return state; } CandidateNodeRole(int term, ElectionTimeout electionTimeout);  CandidateNodeRole(int term, int votesCount, ElectionTimeout electionTimeout); int getVotesCount(); @Override NodeId getLeaderId(NodeId selfId); @Override void cancelTimeoutOrTask(); @Override RoleState getState(); @Override String toString();  }