The @Test annotation is good at checking whether a particular type of exception has been thrown and pretty much nothing else. If you need to be able to check the exception message, it's cause or even the cause message, you need to use a JUnit Rule, specifically the ExpectedException rule.
The code below is expecting JUnit 4.12 and Hamcrest 1.3 libraries. As of version 4.11 JUnit is dependant on Hamcrest 1.3 already.
To set up this rule, the following minimal code is required:
The above sets up the rule in such a way that the no exception is expected. This is the same behaviour as if the rule was not there. I am assuming that fail/pass tests will be mixed in the same test class so expecting every test to throw an exception doesn't make sense, so we overwrite this rule for each test case that does expect an exception being thrown.
Next to set up an accurate exception check, the following additional imports are required...
The actual code to check for the correct exception type, message and cause type and cause message is below.
If you don't care about the cause message, the expectCause() call can be simplified to the following...
With this you can do very accurate fail scenario tests where exceptions are being thrown. It is more code to write, but very well worth the effort if you want good tests.