List of yearly record of Mobile data consumption in Singapore and highlighting the year in which there has been a decrease in the consumption between the quarters. Written in Kotlin, this app supports caching and works on Architectural Components from Android.
The app is composed of one screen.
Allows you to browse through the yearly records of Mobile data consumption in Singapore.
Each result from API call is kept in the database in Result
table.
The API results are cached in the Room database, hence the subsequent request calls to the
API are served from Room database.
NOTE The UI currently loads all Results
items at once, which would not
perform well on lower end devices. But since the list, by virtue of the type
of its content, will not grow exponentially hence one-time load should work
for this problem.
You can open the project in Android studio and press run.
The project uses both instrumentation tests that run on the device and local unit tests that run on your computer. To run both of them and generate a coverage report, you can run:
./gradlew fullCoverageReport
(requires a connected device or an emulator)
The projects uses Espresso for UI testing. Since each fragment is limited to a ViewModel, each test mocks related ViewModel to run the tests.
The project creates an in memory database for each database test but still runs them on the device.
Each ViewModel is tested using local unit tests with mock Repository implementations.
Each Repository is tested using local unit tests with mock web service and mock database.
The project uses MockWebServer project to test REST api interactions.
- Android Support Library
- Android Architecture Components
- Android Data Binding
- Dagger 2 for dependency injection
- Retrofit for REST api communication
- Glide for image loading
- Timber for logging
- espresso for UI tests
- mockito for mocking in tests
- Instrumentation test are not running.