### Question:
LeaderBean extends ZooKeeperServerBean implements LeaderMXBean { public String followerInfo() { StringBuilder sb = new StringBuilder(); for (LearnerHandler handler : leader.getLearners()) { if (handler.getLearnerType() == LearnerType.PARTICIPANT) { sb.append(handler.toString()).append("\n"); } } return sb.toString(); } LeaderBean(Leader leader, ZooKeeperServer zks); String getName(); String getCurrentZxid(); String followerInfo(); @Override String nonVotingFollowerInfo(); @Override long getElectionTimeTaken(); @Override int getLastProposalSize(); @Override int getMinProposalSize(); @Override int getMaxProposalSize(); @Override void resetProposalStatistics(); @Override int getMaxConcurrentSnapSyncs(); @Override void setMaxConcurrentSnapSyncs(int maxConcurrentSnapshots); @Override int getMaxConcurrentDiffSyncs(); @Override void setMaxConcurrentDiffSyncs(int maxConcurrentDiffSyncs);  }### Answer:
@Test public void testFollowerInfo() throws IOException { Map<Long, QuorumServer> votingMembers = new HashMap<Long, QuorumServer>(); votingMembers.put(1L, null); votingMembers.put(2L, null); votingMembers.put(3L, null); when(quorumVerifierMock.getVotingMembers()).thenReturn(votingMembers); LearnerHandler follower = mock(LearnerHandler.class); when(follower.getLearnerType()).thenReturn(LearnerType.PARTICIPANT); when(follower.toString()).thenReturn("1"); when(follower.getSid()).thenReturn(1L); leader.addLearnerHandler(follower); leader.addForwardingFollower(follower); assertEquals("1\n", leaderBean.followerInfo()); assertEquals("", leaderBean.nonVotingFollowerInfo()); LearnerHandler observer = mock(LearnerHandler.class); when(observer.getLearnerType()).thenReturn(LearnerType.OBSERVER); when(observer.toString()).thenReturn("2"); leader.addLearnerHandler(observer); assertEquals("1\n", leaderBean.followerInfo()); assertEquals("", leaderBean.nonVotingFollowerInfo()); LearnerHandler nonVotingFollower = mock(LearnerHandler.class); when(nonVotingFollower.getLearnerType()).thenReturn(LearnerType.PARTICIPANT); when(nonVotingFollower.toString()).thenReturn("5"); when(nonVotingFollower.getSid()).thenReturn(5L); leader.addLearnerHandler(nonVotingFollower); leader.addForwardingFollower(nonVotingFollower); String followerInfo = leaderBean.followerInfo(); assertTrue(followerInfo.contains("1")); assertTrue(followerInfo.contains("5")); assertEquals("5\n", leaderBean.nonVotingFollowerInfo()); }