@Test
  public void testConfigurationPreserved() throws Exception {
    Configuration conf = new Configuration();
    conf.setBoolean("_ENABLED", false);
    conf.setLong("_PRIORITY", 10);
    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(name.getTableName());
    Constraints.add(builder, AlsoWorks.class, conf);
    Constraints.add(builder, WorksConstraint.class);
    assertFalse(Constraints.enabled(builder.build(), AlsoWorks.class));
    List<? extends Constraint> constraints =
      Constraints.getConstraints(builder.build(), this.getClass().getClassLoader());
    for (Constraint c : constraints) {
      Configuration storedConf = c.getConf();
      if (c instanceof AlsoWorks) {
        assertEquals(10, storedConf.getLong("_PRIORITY", -1));
      }
      // its just a worksconstraint
      else {
        assertEquals(2, storedConf.getLong("_PRIORITY", -1));
      }
    }
  }
Test that if a constraint hasn't been set that there are no problems with attempting to remove
it.
hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java