LinkedIn: Refactored test code using Factory Method