Added tests for factory