@Test
  public void testValueOf() {
    Map<String, TableName> inCache = new HashMap<>();
    // fill cache
    for (Names name : names) {
      inCache.put(name.nn, TableName.valueOf(name.ns, name.tn));
    }
    for (Names name : names) {
      assertSame(inCache.get(name.nn), validateNames(TableName.valueOf(name.ns, name.tn), name));
      assertSame(inCache.get(name.nn), validateNames(TableName.valueOf(name.nsb, name.tnb), name));
      assertSame(inCache.get(name.nn), validateNames(TableName.valueOf(name.nn), name));
      assertSame(inCache.get(name.nn), validateNames(TableName.valueOf(name.nnb), name));
      assertSame(inCache.get(name.nn), validateNames(
        TableName.valueOf(ByteBuffer.wrap(name.nsb), ByteBuffer.wrap(name.tnb)), name));
    }
  }
Tests for various kinds of TableNames.
hbase-common/src/test/java/org/apache/hadoop/hbase/TestTableName.java