added test for factory