Tested that exceptions are thrown on invalid inputs.