kezhou2 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Cursor matcher should return false if the column wasn't found so Hamcrest can proceed to the next cursor. #110

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, 

I wasn't sure if we were still using this tracker. 
Should we start logging issues in the android tracker instead?

Steps to reproduce:
1. Create a list view with multiple fragments each backed by it's own cursor 
adapter.

The data in the listview might look something like this:

 <[Data: Row 0: {columnA:"valueA", columnB:"valueB"} (class: Cursor) token: 0, 
    Data: Row 1: {columnC:"valueC", columnD:"valueD" } (class: Cursor) token:1...]>

3. Write Espresso test for this listview using new CursorMatchers:

 onData(CursorMatchers.withRowString("columnC", "valueC")).perform(click());

Expected:
Matcher finds my column and Espresso clicks on the item;

Actual:
Matcher throws "Couldn't find column" on the first cursor and doesn't proceed 
to the second cursor that has my column.

The issue is on the line 87 of CursorMatchers class that should return false if 
the result is COLUMN_NOT_FOUND instead of throwing an exception. 

If the column isn't found across ALL cursors in the listview it will be handled 
 by the no data found exception.

What version of the product are you using? On what operating system?

Espresso 2.0

Original issue reported on code.google.com by KAM...@gmail.com on 21 Dec 2014 at 1:04

GoogleCodeExporter commented 9 years ago
The same error occurs when using a MergedCursor

Original comment by benoitd...@gmail.com on 7 Jan 2015 at 12:41