code: public static boolean expectedCause(final Exception actualException, final Collection<Class<? extends Exception>> expectedExceptions) {
  
          checkNotNull("actualException", actualException);
  
          if (expectedExceptions == null || expectedExceptions.size() == 0) {
              // All exceptions are expected
              return true;
          }
  
          final Throwable cause = actualException.getCause();
          if (!(cause instanceof Exception)) {
              // We're only interested in exceptions
              return false;
          }
  
          return expectedException((Exception) cause, expectedExceptions);
  
      }
docs: Verifies if the cause of an exception is of a given type.
  
  @param actualException
  Actual exception that was caused by something else - Cannot be <code>null</code>.
  @param expectedExceptions
  Expected exceptions - May be <code>null</code> if any cause is expected.
  
  @return TRUE if the actual exception is one of the expected exceptions.