Refactor out common code for other tests