code: public static boolean expectedException(final Exception actualException,
              final Collection<Class<? extends Exception>> expectedExceptions) {
  
          checkNotNull("actualException", actualException);
  
          if (expectedExceptions == null || expectedExceptions.size() == 0) {
              // All exceptions are expected
              return true;
          }
  
          for (final Class<? extends Exception> expectedException : expectedExceptions) {
              if (expectedException.isAssignableFrom(actualException.getClass())) {
                  return true;
              }
          }
  
          return false;
  
      }
docs: Verifies if an exception is of a given type.
  
  @param actualException
  Actual exception - Cannot be <code>null</code>.
  @param expectedExceptions
  Expected exceptions - May be <code>null</code> if any exception is expected.
  
  @return TRUE if the actual exception is one of the expected exceptions.