How can I use JUnit idiomatically to test that some code throws an exception? While I can certainly do something like this: I recall that there is an annotation or an Assert.xyz or something that is far less kludgy and far more in-the-spirit of JUnit for these sorts of situations. Answer It depends on the JUnit version and what assert