@Test
  public void testDisableConstraints() 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));
    }
    // add a constraint to check to see if is run
    Constraints.add(builder, CheckWasRunConstraint.class);

    // then disable all the constraints
    Constraints.disable(builder);

    util.getAdmin().createTable(builder.build());
    Table table = util.getConnection().getTable(tableName);
    try {
      // test that we do fail on violation
      Put put = new Put(row1);
      byte[] qualifier = new byte[0];
      put.addColumn(dummy, qualifier, Bytes.toBytes("pass"));
      LOG.warn("Doing put in table");
      table.put(put);
    } finally {
      table.close();
    }
    assertFalse(CheckWasRunConstraint.wasRun);
  }
Test that if we disable all constraints, then nothing gets run
hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraint.java