while (!pending.isEmpty() && result.getCount() < MAX_SEARCH_RESULTS) { final File file = pending.removeFirst();
@Test public void shouldAddIterablesAsRows() throws Exception { MatrixCursor cursor = new MatrixCursor(new String[]{"a", "b", "c"}); cursor.addRow(Arrays.asList(new Object[]{"foo", 10L, 0.1f})); cursor.addRow(Arrays.asList(new Object[]{"baz", 20L, null})); assertThat(cursor.getCount()).isEqualTo(2); assertTrue(cursor.moveToFirst()); assertThat(cursor.getString(0)).isEqualTo("foo"); assertThat(cursor.getLong(1)).isEqualTo(10L); assertThat(cursor.getFloat(2)).isEqualTo(0.1f); assertTrue(cursor.moveToNext()); assertThat(cursor.getString(0)).isEqualTo("baz"); assertThat(cursor.getLong(1)).isEqualTo(20L); assertTrue(cursor.isNull(2)); assertFalse(cursor.moveToNext()); }
@Test public void shouldAddObjectArraysAsRows() throws Exception { MatrixCursor cursor = new MatrixCursor(new String[]{"a", "b", "c"}); cursor.addRow(new Object[]{"foo", 10L, 0.1f}); cursor.addRow(new Object[]{"baz", 20L, null}); assertThat(cursor.getCount()).isEqualTo(2); assertTrue(cursor.moveToFirst()); assertThat(cursor.getString(0)).isEqualTo("foo"); assertThat(cursor.getLong(1)).isEqualTo(10L); assertThat(cursor.getFloat(2)).isEqualTo(0.1f); assertTrue(cursor.moveToNext()); assertThat(cursor.getString(0)).isEqualTo("baz"); assertThat(cursor.getLong(1)).isEqualTo(20L); assertTrue(cursor.isNull(2)); assertFalse(cursor.moveToNext()); }
Log.e("test",e.toString()); Toast.makeText(getApplicationContext(), cursor.getCount(),Toast.LENGTH_LONG).show();
while (!pending.isEmpty() && result.getCount() < MAX_SEARCH_RESULTS) {
@Test public void testCursor() { MatrixCursor cursor = new MatrixCursor(new String[] { "id" }); for (String s : new String[] { "1", "2", "3" }) { cursor.addRow(new String[] { s }); } cursor.moveToPosition(0); assertThat(cursor.moveToPrevious(), is(true)); cursor.moveToPosition(cursor.getCount()-1); assertThat(cursor.moveToNext(), is(true)); assertThat(cursor.moveToPosition(c.getCount()), is(true)); assertThat(cursor.moveToPosition(-1), is(true)); }