@Test
  public void testExceptionDuringInitialization() throws Exception {
    Configuration conf = TEST_UTIL.getConfiguration();
    conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2); // Let's fail fast.
    conf.setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, true);
    conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, "");
    TEST_UTIL.startMiniCluster(2);
    try {
      SingleProcessHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
      // Trigger one regionserver to fail as if it came up with a coprocessor
      // that fails during initialization
      final HRegionServer regionServer = cluster.getRegionServer(0);
      conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
        FailedInitializationObserver.class.getName());
      regionServer.getRegionServerCoprocessorHost().loadSystemCoprocessors(conf,
        CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
      TEST_UTIL.waitFor(10000, 1000, new Predicate<Exception>() {
        @Override
        public boolean evaluate() throws Exception {
          return regionServer.isAborted();
        }
      });
    } finally {
      TEST_UTIL.shutdownMiniCluster();
    }
  }
Tests unhandled exceptions thrown by coprocessors running on a regionserver.. Expected result is
that the regionserver will abort with an informative error message describing the set of its
loaded coprocessors for crash diagnosis. (HBASE-4014).
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionServerCoprocessorExceptionWithAbort.java