Exception handling in unit test