I\'ve got the following test:
@Test(expected = IllegalStateException.class)
public void testKey() {
int key = 1;
this.finder(key);
}
<
i tried this one, and work perfectly as expected.
public class SampleClassTest {
@Test(expected = ArithmeticException.class )
public void lost(){
this.lost(0);
}
private void lost(int i) throws ArithmeticException {
System.out.println(3/i);
}
}
also ensure that junit4 is added as dependancy, @ (annotations) are new feature in junit 4.