Added tests for the factory function.