Exception rising and catching added
Adapted test to the use of exceptions.
Integrated exception handling in unit tests.