@Override
  public void setConf(Configuration conf) {
    super.setConf(conf);
    if (conf != null) {
      String val = conf.get(key);
      if (val == null || !val.equals(value))
        throw new IllegalArgumentException("Configuration was not passed correctly");
      // and then check to make sure we got a fresh config by checking for a
      // hadoop-based config value, and if we don't find it, its fine
      if (
        conf.getRaw("fs.file.impl") != null
      ) throw new IllegalArgumentException(
        "Configuration was created using 'new Configuration()', should be "
          + "done via 'new Configuration(false) to exclude defaut hadoop "
          + "configurations values.");
    }
  }
Test Constraint to check to make sure the configuration is set
hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/CheckConfigurationConstraint.java