Add unit test for exception.