public static void verifyTags(Table table) throws IOException {
    ResultScanner s = table.getScanner(new Scan());
    for (Result r : s) {
      for (Cell c : r.listCells()) {
        Optional<Tag> tag =
          PrivateCellUtil.getTag((ExtendedCell) c, TagType.MOB_TABLE_NAME_TAG_TYPE);
        if (!tag.isPresent()) {
          fail(c.toString() + " has null tag");
          continue;
        }
        Tag t = tag.get();
        byte[] tval = Tag.cloneValue(t);
        assertArrayEquals(c.toString() + " has tag" + Bytes.toString(tval), r.getRow(), tval);
      }
    }
  }
This verifies that each cell has a tag that is equal to its rowkey name. For this to work the
hbase instance must have HConstants.RPC_CODEC_CONF_KEY set to
KeyValueCodecWithTags.class.getCanonicalName());
@param table table containing tagged cells
@throws IOException if problems reading table
hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileTestUtil.java