### Question:
FollowerNodeRole extends AbstractNodeRole { public NodeId getLeaderId() { return leaderId; } FollowerNodeRole(int term, NodeId votedFor, NodeId leaderId, ElectionTimeout electionTimeout); NodeId getVotedFor(); NodeId getLeaderId(); @Override NodeId getLeaderId(NodeId selfId); @Override void cancelTimeoutOrTask(); @Override RoleState getState(); @Override String toString();  }### Answer:
@Test public void testGetNameAndLeaderId() { FollowerNodeRole role = new FollowerNodeRole(1, null, null, ElectionTimeout.NONE); RoleNameAndLeaderId state = role.getNameAndLeaderId(NodeId.of("B")); Assert.assertEquals(RoleName.FOLLOWER, state.getRoleName()); Assert.assertNull(state.getLeaderId()); }
@Test public void testGetNameAndLeaderId2() { FollowerNodeRole role = new FollowerNodeRole(1, null, NodeId.of("A"), ElectionTimeout.NONE); RoleNameAndLeaderId state = role.getNameAndLeaderId(NodeId.of("B")); Assert.assertEquals(RoleName.FOLLOWER, state.getRoleName()); Assert.assertEquals(NodeId.of("A"), state.getLeaderId()); }