Improve test to avoid masking exception