Writing a mock web service
Many times when developing a mobile application, you may need to begin the development of your application before the real backend web service is available. To prevent the development from halting entirely, a good approach would be to develop a mock version of the service. This is also helpful when you need to write unit tests, or you must wait to add a real backend to your app later.
First, let's break down the operations our app will perform against a web server. The operations are as follows:
- Log in with a username and password.
- Register a new account.
- Get the user's list of friends.
- Add friends by their usernames.
- Get a list of the existing conversations for the user.
- Get a list of messages in a conversation.
- Send a message. ...