@Test
 public void testGetRegionsCatalogTables() throws IOException, InterruptedException {
   List<HRegionInfo> regions = MetaReader.getTableRegions(ct, HConstants.META_TABLE_NAME);
   assertTrue(regions.size() >= 1);
   assertTrue(
       MetaReader.getTableRegionsAndLocations(ct, Bytes.toString(HConstants.META_TABLE_NAME))
               .size()
           >= 1);
   assertTrue(
       MetaReader.getTableRegionsAndLocations(ct, Bytes.toString(HConstants.ROOT_TABLE_NAME))
               .size()
           == 1);
 }
 @Test
 public void testTableExists() throws IOException {
   final String name = "testTableExists";
   final byte[] nameBytes = Bytes.toBytes(name);
   assertFalse(MetaReader.tableExists(ct, name));
   UTIL.createTable(nameBytes, HConstants.CATALOG_FAMILY);
   assertTrue(MetaReader.tableExists(ct, name));
   HBaseAdmin admin = UTIL.getHBaseAdmin();
   admin.disableTable(name);
   admin.deleteTable(name);
   assertFalse(MetaReader.tableExists(ct, name));
   assertTrue(MetaReader.tableExists(ct, Bytes.toString(HConstants.META_TABLE_NAME)));
   assertTrue(MetaReader.tableExists(ct, Bytes.toString(HConstants.ROOT_TABLE_NAME)));
 }
  @Test
  public void testGetRegion() throws IOException, InterruptedException {
    final String name = "testGetRegion";
    LOG.info("Started " + name);
    final byte[] nameBytes = Bytes.toBytes(name);
    HTable t = UTIL.createTable(nameBytes, HConstants.CATALOG_FAMILY);
    int regionCount = UTIL.createMultiRegions(t, HConstants.CATALOG_FAMILY);

    // Test it works getting a region from user table.
    List<HRegionInfo> regions = MetaReader.getTableRegions(ct, nameBytes);
    assertEquals(regionCount, regions.size());
    Pair<HRegionInfo, HServerAddress> pair =
        MetaReader.getRegion(ct, regions.get(0).getRegionName());
    assertEquals(regions.get(0).getEncodedName(), pair.getFirst().getEncodedName());
    // Test get on non-existent region.
    pair = MetaReader.getRegion(ct, Bytes.toBytes("nonexistent-region"));
    assertNull(pair);
    // Test it works getting a region from meta/root.
    pair = MetaReader.getRegion(ct, HRegionInfo.FIRST_META_REGIONINFO.getRegionName());
    assertEquals(
        HRegionInfo.FIRST_META_REGIONINFO.getEncodedName(), pair.getFirst().getEncodedName());
    LOG.info("Finished " + name);
  }