How to use AdapterViewProtocol in espresso?

2019-08-06 12:05发布

问题:

I use Espresso 2.0 library to test an Android project, and I need to use method onData, but I have custom ProductsAdapter, so I must implement AdapterViewProtocol (android.support.test.espresso.action.AdapterViewProtocol),

I need to find a working example implementing AdapterViewProtocol for onData method.

I have only found this: https://gist.github.com/brennantaylor/9379399. But I want small and working project. Help me, please.

回答1:

You can try to look at this example with CursorAdapter: https://gist.github.com/brennantaylor/9379399 .

Or in standard Espresso implementation: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocols.java#AdapterViewProtocols.StandardAdapterViewProtocol