Added tests for factory.