@Test
  public void testPb() throws DeserializationException, IOException {
    final int v = 123;
    TableDescriptor htd =
      TableDescriptorBuilder.newBuilder(TableName.META_TABLE_NAME).setMaxFileSize(v)
        .setDurability(Durability.ASYNC_WAL).setReadOnly(true).setRegionReplication(2).build();

    byte[] bytes = TableDescriptorBuilder.toByteArray(htd);
    TableDescriptor deserializedHtd = TableDescriptorBuilder.parseFrom(bytes);
    assertEquals(htd, deserializedHtd);
    assertEquals(v, deserializedHtd.getMaxFileSize());
    assertTrue(deserializedHtd.isReadOnly());
    assertEquals(Durability.ASYNC_WAL, deserializedHtd.getDurability());
    assertEquals(2, deserializedHtd.getRegionReplication());
  }
Test setting values in the descriptor.
hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTableDescriptorBuilder.java