@Test
  public void testMasterAddressParsing() throws Exception {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    int numMasters = 10;
    conf.set(HConstants.MASTER_ADDRS_KEY, generateDummyMastersList(numMasters));
    List<ServerName> parsedMasters = new ArrayList<>(MasterRegistry.parseMasterAddrs(conf));
    // Half of them would be without a port, duplicates are removed.
    assertEquals(numMasters / 2 + 1, parsedMasters.size());
    // Sort in the increasing order of port numbers.
    Collections.sort(parsedMasters, Comparator.comparingInt(ServerName::getPort));
    for (int i = 0; i < parsedMasters.size(); i++) {
      ServerName sn = parsedMasters.get(i);
      assertEquals("localhost", sn.getHostname());
      if (i == parsedMasters.size() - 1) {
        // Last entry should be the one with default port.
        assertEquals(HConstants.DEFAULT_MASTER_PORT, sn.getPort());
      } else {
        assertEquals(1000 + (2 * i), sn.getPort());
      }
    }
  }
Makes sure the master registry parses the master end points in the configuration correctly.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMasterRegistry.java