Added tests for throwing exceptions.