Take a look at org.junit.rules.ExpectedException junit rule. It should make it cleaner.