assertNotThrown

fnauto assertNotThrown(T : Throwable = Exception, E)(lazy E expression, string msg = null, string file = __FILE__, size_t line = __LINE__)

Asserts that the given expression does not throw the given type of Throwable. If a Throwable of the given type is thrown, it is caught and does not escape assertNotThrown. Rather, an AssertError is thrown. However, any other Throwables will escape.

Parameters

TThe Throwable to test for.
expressionThe expression to test.
msgOptional message to output on test failure. If msg is empty, and the thrown exception has a non-empty msg field, the exception's msg field will be output on test failure.
fileThe file where the error occurred. Defaults to __FILE__.
lineThe line where the error occurred. Defaults to __LINE__.

Throws

AssertError if the given Throwable is thrown.

Returns

the result of expression.