Pages

Thursday, February 10, 2011

Unexpected behaviour with JUnit ExpectedException

The JUnit ExpectedException allows specification of expected exception types and messages. One would think that code throwing the exception would carry on executing any lines following it as the exception is expected. This is not the case.

The solution is to make sure that the code throwing the exception is the last line of the method.

0 comments:

Post a Comment

 
Powered by Blogger