F1sher F1sher - 1 month ago 14
Android Question

Espresso how to assert intent data

This is my intent:


-Intent { act=android.intent.action.VIEW dat=smsto:xxxxxxx@xxxxx.xxx (has extras) } handling packages:[[com.android.messaging]],
extras:[Bundle[{sms_body=myText}]])


How matcher should look like in order to assert data like this:


dat=smsto:xxxxxxx@xxxxx.xxx


For example this won't work:

intented(hasData("xxxxxxx@xxxxx.xxx");

Answer

Try this :

intented(hasData(Uri.parse("smsto:xxxxxxx@xxxxx.xxx"));

It should work !

(Replace 'xxx's with actual characters.)

Comments