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.

Stubbing: Intending

Stubbing: Intending - Android Tutorial

From the course: Advanced Android Espresso Testing

Start my 1-month free trial

Stubbing: Intending

- [Instructor] We have verified the incoming intent for IdeasActivity and the outgoing intent for MainActivity. Let's verify the activity result returning from IdeasActivity to MainActivity, namely the cat name. We will be using intending instead of intended to do that. Both intending and intended checks the outgoing intent of an activity. The difference is that intended just watches what happens. In other words, it launches the activity and records the intent passed to it. Intending, on the other hand, does not launch the activity. It intercepts and blocks the activity from launching. This is great if you want to stop out the activity result. To stop the activity result, we will call intending with the same intent matcher, and add respondsWith at the end to specify the activity result we want. Let's do that next.

Contents