Closed berdroid closed 8 years ago
There is no real advantage over assertThrown
from std.exception
.
JUnit 5, however, introduced expectThrows
, which returns the expected exception, so that it can be further verified. With the switch to JUnit 5, expectThrows
is now available in dunit.assertion
.
This new assert method tests for an expression to throw a defined exception. If it does, the test passes. Otherwise an AssertException is thrown. The expected exception type is given as a template parameter.