### Question:
FluentCursor extends CrossProcessCursorWrapper { public int toRowCount() { try { return getCount(); } finally { close(); } } FluentCursor(Cursor cursor); FluentIterable<T> toFluentIterable(Function<? super Cursor, T> singleRowTransform); LazyCursorList<T> toLazyCursorList(Function<? super Cursor, T> singleRowTransform); LinkedHashMultimap<TKey, TValue> toMultimap(Function<? super Cursor, TKey> keyTransform, Function<? super Cursor, TValue> valueTransform); LinkedHashMap<TKey, TValue> toMap(Function<? super Cursor, TKey> keyTransform, Function<? super Cursor, TValue> valueTransform); T toOnlyElement(Function<? super Cursor, T> singleRowTransform); T toOnlyElement(Function<? super Cursor, T> singleRowTransform, T defaultValue); int toRowCount(); FluentCursor withNotificationUri(ContentResolver resolver, Uri uri);  }### Answer:
@Test public void shouldCloseCursorWhenGettingRowCount() throws Exception { Cursor mock = mock(Cursor.class); new FluentCursor(mock).toRowCount(); verify(mock).close(); }
@Test public void shouldConvertToCorrectRowCount() throws Exception { Cursor mock = mock(Cursor.class); when(mock.getCount()).thenReturn(42); assertThat(new FluentCursor(mock).toRowCount()).isEqualTo(42); }
@Test public void shouldNotIterateOverCursorWhenTransformingCursorToRowCount() throws Exception { Cursor mock = mock(Cursor.class); new FluentCursor(mock).toRowCount(); verify(mock, never()).moveToFirst(); verify(mock, never()).moveToNext(); verify(mock, never()).moveToLast(); verify(mock, never()).moveToPrevious(); verify(mock, never()).moveToPosition(anyInt()); }