I\'ve got the following test:
@Test(expected = IllegalStateException.class) public void testKey() { int key = 1; this.finder(key); }
The problem was, that the class in which the test was nested was an extension of TestCase. Since this is JUnit 3 style, the annotation didn't work.
TestCase
Now my test class is a class on its own.