Objective of this repository is to reduce the classes from original sample and make it easy to understand
This sample is written in Kotlin and based on the master branch which uses the following Architecture Components:
- ViewModel
- LiveData
- Data Binding
- Navigation
- Room
It uses Dagger 2 and Dagger-Android for dependency injection. The Dagger setup is deliberately simple and unopinionated.
- The ServiceLocator class is removed. Object creation and scoping is handled by Dagger.
- Flavors
mock
andprod
are no longer needed for testing so they're removed.
The di
directory contains all DI-related classes. This is done to improve browsing the files
but feature modules are usually placed alongside their packages (i.e. TaskDetailModule in
the detail
package).
ApplicationComponent
and its testing counterpart TestApplicationComponent
define different
modules for production and UI testing.
UI tests don't rely on using the mock
flavor to run quickly and hermetically. Instead, they
replace Dagger components with their test versions.
This is done by creating a CustomTestRunner
which starts the TestTodoApplication
instead of the TodoApplication
. DaggerTestApplicationRule
creates the TestApplicationComponent
and injects the Application.