DRY'd up some test code.