Added tests for exceptions

Code style fixes