I\'ve got the following test:
@Test(expected = IllegalStateException.class)
public void testKey() {
int key = 1;
this.finder(key);
}
<
No, this JUnit test should work as it is - there is nothing more needed on this side.
What makes you sure that the test throws an IllegalStateException? Is it possible that it gets wrapped into another exception of different type?
Please post the exact failure message from JUnit.
As @duffymo suggested, it is easy to verify what (if any) exception the test really throws.