I am having difficulty understanding which design pattern would be best for the following scenario. An application uses a database. That database can either be the production version (SQL) or a test version (Test). Here’s my current design:
The problem with this design is that application has to create Test, which it shouldn’t be doing (since it’s purely for testing). However, Application must somehow get reference to the database it’s going to use, either SQL or Test.
What design pattern could I implement to fool application into creating the Test version of the database? How would this solution look in UML?
I have already done enough research to narrow my choices to Abstract Factory, Builder, or Factory Method (or the combination of any)