-
Notifications
You must be signed in to change notification settings - Fork 61
DatabaseManager singleton makes testing difficult #295
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestrequirements:high changeThis code introduces a significant changes to the requirements for the projectThis code introduces a significant changes to the requirements for the projectrequirements:low changeThis code introduces a small change in requirements for the projectThis code introduces a small change in requirements for the project
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestrequirements:high changeThis code introduces a significant changes to the requirements for the projectThis code introduces a significant changes to the requirements for the projectrequirements:low changeThis code introduces a small change in requirements for the projectThis code introduces a small change in requirements for the project
The global DatabaseManager class makes it difficult to do testing using dependency inversion.
clear) in order to enable testing.Most implementations are already passing a DataAccess object around and so there is little value in a DatabaseManager singleton. We should just initialize the DataAccess object with the desired DatabaseManager. Then a test could provide a mocked database version if desired, or set up and tear down a test database. You could get rid of the
clearendpoint.