Add test for factory