added test for the factory pattern