Reduce duplication in test