Added support for mocking out any factory.