@Test
  public void testIsUnloaded() throws Exception {
    // create the table
    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName);

    // add a family to the table
    for (byte[] family : new byte[][] { dummy, test }) {
      builder.setColumnFamily(ColumnFamilyDescriptorBuilder.of(family));
    }
    // make sure that constraints are unloaded
    Constraints.add(builder, RuntimeFailConstraint.class);
    // add a constraint to check to see if is run
    Constraints.add(builder, CheckWasRunConstraint.class);
    CheckWasRunConstraint.wasRun = false;

    util.getAdmin().createTable(builder.build());
    Table table = util.getConnection().getTable(tableName);

    // test that we do fail on violation
    Put put = new Put(row1);
    byte[] qualifier = new byte[0];
    put.addColumn(dummy, qualifier, Bytes.toBytes("pass"));

    try {
      table.put(put);
      fail("RuntimeFailConstraint wasn't triggered - this put shouldn't work!");
    } catch (Exception e) {// NOOP
    }

    // try the put again, this time constraints are not used, so it works
    table.put(put);
    // and we make sure that constraints were not run...
    assertFalse(CheckWasRunConstraint.wasRun);
    table.close();
  }
Check to make sure a constraint is unloaded when it fails
hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraint.java