private static <V, E> void runWithExpectedException(Callable<V> callable,
    Class<E> exceptionClass) {
    try {
      callable.call();
    } catch (Exception ex) {
      LOG.info("Get exception is " + ex);
      assertEquals(exceptionClass, ex.getCause().getClass());
      return;
    }
    fail("Should have thrown exception " + exceptionClass);
  }
Class to test asynchronous namespace admin operations.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNamespaceAdminApi.java