Intercepting error messages in test.