Fix test by catching expected exception