If you have Dagger in your project but never used it for testing, it’s high time to give it a try. Dagger makes your code so much easier to test. Once the test setup is complete, all you have to do is plug and play with the dependencies. Also, dependency injection is a crucial concept in testing, and you should use it whenever possible.
To read the full article, please check here.
The App uses MVVM design pattern along with a Data Repository.
The sample app has only one screen that searches through Github repo by a keyword. The app fetches the API response through a Data Repository and outputs the result inside a ViewModel. Finally, an Activity watches for LiveData changes and sets the output inside a TextView.
The app uses the following 3rd party libraries:
- Android Jetpack Components (ViewModel, LiveData)
- Dagger 2
- Retrofit
- jUnit4
- Mockk