Refactor tests for PersistentFactoryTest to test stuff. Also Add test for InMemoryFactory