Extracted helper functions in tests