Reduce nesting in test