Make sure the exception is thrown when it happens during test