Refactor test to be more DRY.