Better way to test exceptions being thrown