I have a simple application with a UI with a backend connection, from which i get the data. Now, during development, I wouldn't like to connect to the backend as it slows me down. So, i have some locally stored data and i 'mock' the connection to return the locally stored data instead of making a server call.
Now, this is not for writing test cases (hence, i do not see if mocking frameworks come in the picture), but just being able to switch between between a local and remote connection during development.
There are many ways to do this, i suppose:
- Obtaining the connection from a factory (or via dependency injection) and setting a flag that returns the local connection
- Maintaining a properties file, where i set 'local=true' or something similar that returns the local connection.
Are there any other ways of achieving this?