Testing for Expected Exceptions in JUnit 5: Quite an Improvement
There are a few different ways to test that a constructor or other unit in a Java program throws a certain exception. JUnit 5 introduced a new way of testing for expected exceptions, which is an improvement from what was available for the purpose in previous versions.
Maybe with JUnit 4 you preferred the good old-fashioned Try-Catch with fail()
. I did…