Fix a warning when generating tests

Closes #7589