That has the problem of separating the statement that is supposed to throw and then thrown exception. E.g. a slightly more complicated test case:
@Test(expectedExceptions = FooException.class)
public void test() {
firstDoThis();
thenThat();
thenSomeMore();
thisShouldThrow();
}
Now you're only asserting that any of these statements throw, anywhere in the code under test. That's significantly weaker and I've seen it mask real problems in code.I think using plain try something/fail/catch is clearer, or using Closures and an assertThrows if your language supports it.