@Test
  public void testReadWriteWithConf() throws Exception {
    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(name.getTableName());
    Constraints.add(builder, new Pair<>(CheckConfigurationConstraint.class,
      CheckConfigurationConstraint.getConfiguration()));

    List<? extends Constraint> c =
      Constraints.getConstraints(builder.build(), this.getClass().getClassLoader());
    assertEquals(1, c.size());

    assertEquals(CheckConfigurationConstraint.class, c.get(0).getClass());

    // check to make sure that we overwrite configurations
    Constraints.add(builder,
      new Pair<>(CheckConfigurationConstraint.class, new Configuration(false)));

    try {
      Constraints.getConstraints(builder.build(), this.getClass().getClassLoader());
      fail("No exception thrown  - configuration not overwritten");
    } catch (IllegalArgumentException e) {
      // expect to have the exception, so don't do anything
    }
  }
Test reading/writing the constraints into the {@link TableDescriptorBuilder}.
hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java