LeaderManager { static String getLeaderPath(String lockName) { if(lockName == null) { throw new NullPointerException("lock name is null"); } StringBuilder path = new StringBuilder(64); path.append("/dp/leader/"); String appName = Environment.getAppName(); if(appName == null) { logger.warn("app name is null, use \"default\""); appName = "default"; } path.append(appName).append('/').append(lockName); return path.toString(); } private  LeaderManager(String zookeeperAddress); static LeaderManager getInstance(); static LeaderManager getInstance(String zookeeperAddress); LeaderLock takeLeadership(final String lockName, final LeaderCallback callback); void releaseLeadership(LeaderLock lock);  }
@Test public void testGetLeaderPath() { String leaderPath = LeaderManager.getLeaderPath("hello"); assertEquals(leaderPath, "/dp/leader/default/hello"); }