### Question:
LeaderElectionSupport implements Watcher { public String getLeaderHostName() throws KeeperException, InterruptedException { List<LeaderOffer> leaderOffers = toLeaderOffers(zooKeeper.getChildren(rootNodeName, false)); if (leaderOffers.size() > 0) { return leaderOffers.get(0).getHostName(); } return null; } LeaderElectionSupport(); synchronized void start(); synchronized void stop(); String getLeaderHostName(); @Override void process(WatchedEvent event); void addListener(LeaderElectionAware listener); void removeListener(LeaderElectionAware listener); @Override String toString(); String getRootNodeName(); void setRootNodeName(String rootNodeName); ZooKeeper getZooKeeper(); void setZooKeeper(ZooKeeper zooKeeper); synchronized String getHostName(); synchronized void setHostName(String hostName);  }### Answer:
@Test public void testGetLeaderHostName() throws Exception { LeaderElectionSupport electionSupport = createLeaderElectionSupport(); electionSupport.start(); Thread.sleep(3000); String leaderHostName = electionSupport.getLeaderHostName(); assertNotNull(leaderHostName); assertEquals("foohost", leaderHostName); electionSupport.stop(); }