@Test
  public void testMasterPortDefaults() throws Exception {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    conf.set(HConstants.MASTER_ADDRS_KEY, "localhost");
    List<ServerName> parsedMasters = new ArrayList<>(MasterRegistry.parseMasterAddrs(conf));
    ServerName sn = parsedMasters.get(0);
    assertEquals(HConstants.DEFAULT_MASTER_PORT, sn.getPort());
    final int CUSTOM_MASTER_PORT = 9999;
    conf.setInt(HConstants.MASTER_PORT, CUSTOM_MASTER_PORT);
    parsedMasters = new ArrayList<>(MasterRegistry.parseMasterAddrs(conf));
    sn = parsedMasters.get(0);
    assertEquals(CUSTOM_MASTER_PORT, 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