unit test for exception handling