Test that the correct exceptions are thrown in exceptional situations.