Refactor: Mocked Factory setup in tests