Exercise 4.01 – adding tests to coroutines in an Android app
For this exercise, you will be continuing the movie app that you worked on in Exercise 2.01, Using coroutines in an Android app. This application displays the movies that are currently playing in cinemas. You will be adding unit tests for the coroutines in the project by following these steps:
- Open the movie app you worked on in Exercise 2.01, Using coroutines in an Android app, in Android Studio.
- Go to the
app/build.gradle
file and add the following dependencies, which will be used for the unit test:testImplementation ‘org.mockito.kotlin:mockito- kotlin:4.0.0’ testImplementation ‘androidx.arch.core:core- testing:2.1.0’ testImplementation ‘org.jetbrains.kotlinx:kotlinx- coroutines-test:1.6.0’
The first line will add Mockito-Core and Mockito-Kotlin, the second line will add the architecture testing library, and the last...