I like to avoid putting the text of user-facing messages into a test, but it can be difficult to avoid sometimes. In some cases, I've just searched for a keyword or three in the error message as a compromise. Just a thought.