Add test coverage for DatabaseFactory

- Adds tests for most methods in DatabaseFactory
- Changes getInstance to instantiate a new instance of DatabaseFactory if a static instance isn't cached