Broke out more test code into an appropriate helper.