Refactor: extracted function for mock creation