Check an exception message in tests