Fixed Unit test and code. Added test for checking exception