code: private boolean containsType(Throwable exception, Class<? extends Exception> expectedType) {
          Throwable transformedException = transform(exception);
  
          if (transformedException == null) {
              return false;
          }
          if (expectedType.isAssignableFrom(transformedException.getClass())) {
              return true;
          }
  
          return containsType(transformedException.getCause(), expectedType);
      }
docs: /*
  public void verifyExpectedExceptionDuringUnDeploy(@Observes EventContext<UnDeployDeployment> context) throws Exception
  {
  DeploymentDescription deployment = context.getEvent().getDeployment();
  try
  {
  context.proceed();
  }
  catch (Exception e)
  {
  if(deployment.getExpectedException() == null)
  {
  throw e;
  }
  }
  }