As you know, exception is thrown at the condition of abnormal scenarios. So how to analog these exceptions? I feel it is challenge. For such code snippets:
p
You can tell junit that the correct behavior is to get an exception.
In JUnit 4, it goes something like:
@Test(expected = MyExceptionClass.class) public void functionUnderTest() { … }