@Override
  public boolean connect(StatsCollectionContext context) {
    errorMethod = HiveConf.getVar(context.getHiveConf(), HiveConf.ConfVars.HIVE_TEST_MODE_DUMMY_STAT_PUB);
    if (errorMethod.equalsIgnoreCase("connect")) {
      return false;
    }

    return true;
  }
An test implementation for StatsPublisher.
The method corresponding to the configuration parameter
hive.test.dummystats.publisher fail, whereas all
other methods succeed
itests/util/src/main/java/org/apache/hadoop/hive/ql/stats/DummyStatsPublisher.java