unit test for exception cases