private void scan(boolean validateStartcode, String serverName) throws IOException {
    InternalScanner scanner = null;
    Scan scan = null;
    List<Cell> results = new ArrayList<>();
    byte[][][] scanColumns = { COLS, EXPLICIT_COLS };
    for (int i = 0; i < scanColumns.length; i++) {
      try {
        scan = new Scan().withStartRow(FIRST_ROW);
        for (int ii = 0; ii < EXPLICIT_COLS.length; ii++) {
          scan.addColumn(COLS[0], EXPLICIT_COLS[ii]);
        }
        scanner = region.getScanner(scan);
        while (scanner.next(results)) {
          assertTrue(
            hasColumn(results, HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER));
          byte[] val = CellUtil.cloneValue(
            getColumn(results, HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER));
          validateRegionInfo(val);
          if (validateStartcode) {
            // assertTrue(hasColumn(results, HConstants.CATALOG_FAMILY,
            // HConstants.STARTCODE_QUALIFIER));
            // val = getColumn(results, HConstants.CATALOG_FAMILY,
            // HConstants.STARTCODE_QUALIFIER).getValue();
            assertNotNull(val);
            assertFalse(val.length == 0);
            long startCode = Bytes.toLong(val);
            assertEquals(START_CODE, startCode);
          }

          if (serverName != null) {
            assertTrue(hasColumn(results, HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER));
            val = CellUtil.cloneValue(
              getColumn(results, HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER));
            assertNotNull(val);
            assertFalse(val.length == 0);
            String server = Bytes.toString(val);
            assertEquals(0, server.compareTo(serverName));
          }
        }
      } finally {
        InternalScanner s = scanner;
        scanner = null;
        if (s != null) {
          s.close();
        }
      }
    }
  }
Use a scanner to get the region info and then validate the results
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java