I commenced with simple VIPER architecture and tried to solve different problems by focussing on how the make presenter testable using only local unit test-cases.
As per VIPER with some customization, we have following components -
- View : Activity, Fragments, Dialog Fragments etc.
- Presenter : Presenter will contain all view logic and generate a view-model and provide it to the view. With any action on view, view-model can be updated by presenter.
- View-Model : It is a POJO which represents our view.
- Interactor : It will take care of different data sources like database, network etc. It will also contain business logic. It will provide data like location, sensors etc. from android system-services. All the data will be provided in the form of an entity.
- Entity : It is a POJO for our data.
- Navigator : It will contain methods like finish, showToast, startActivity, showProgressDialog etc. This class will be injected in presenter for routing and android related events. This will be mocked at the time of testing presenter.
- Prefs and Resource Provider : Prefs is a wrapper class for preferences whereas ResourceProvider is a wrapper class for resources. These classes can be injected in presenter as per the requirement and can be mocked at the time of testing presenter.
For more detail go to this article.