Use built-in method to test exceptions.