public static <T extends Throwable> T assertThrowsOrNot(final T expected, final Executable executable, final String message) {
        if (expected == null) {
            assertDoesNotThrow(executable, message);
            return null;
        }
        return (T) assertThrows(expected.getClass(), executable, message);
    }
Null safe assertThrows and assertDoesNotThrow..

@param expected   Expected exception type. +null+ if no exception should be thrown.
@param executable Procedure to assert thrown exception.
@param message    Message for test case.
@param <T>        Type of exception to be expected.
@return Exception thrown in assertion process.
core/cas-server-core-util-api/src/test/java/org/apereo/cas/util/junit/Assertions.java