ExpectedException in jUnit?

assertions, expected-exception, junit, nunit

Solution

junit4:

@Test(expected = org.dom4j.DocumentException.class)
void shouldThrowException() {
    getFile(null);
}

junit3:

void testShouldThrowException() {
    try {
      getFile(null);
      fail("Expected Exception DocumentException");
    } catch(DocumentException e) {}
}

Problem

Is there an equivalent to NUnit's ExpectedException or Assert.Throws<> in jUnit?

Original source