From the course: Advanced Android Espresso Testing

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

TestApplication

TestApplication - Android Tutorial

From the course: Advanced Android Espresso Testing

Start my 1-month free trial

TestApplication

- [Instructor] Now that we have extracted the time dependency into the application, we will create a test application so that we can override provideClock to return a fixed time. Go to your project tree and expand Android test. Click on the package name, right click, New, Kotlin File/Class. We will call it TestApplication. Inside, we will create the class TestApplication. Class TestApplication: GreetingApplication. This means that we want to subclass GreetingApplication. However, Kotlin is not happy because GreetingApplication, by default, is a final class. Press Alt + Enter to make it open. If you Command + click on GreetingApplication, you can see on line five that the keyword open has been added for us. With that, we can subclass GreetingApplication. On the gutter, you can see that there's an O, arrow down. That means there's a subclass, and when you click on it, it will jump to the TestApplication subclass. We have this subclass because we want to override the provideClock method,…

Contents