BackupCursors implements Iterator<BackupCursors.CursorAndType> { public int count() { int total = 0; for (CursorAndType ct : cursorAndTypes) { total += ct.cursor.getCount(); } return total; } BackupCursors(); int count(); int count(DataType type); @Override boolean hasNext(); @Override CursorAndType next(); @Override void remove(); void close();  }
@Test public void shouldReportTotalCountOfAllCursors() throws Exception { assertThat(cursors.count()).isEqualTo(5); }
@Test public void shouldReportCountForDataType() throws Exception { assertThat(cursors.count(SMS)).isEqualTo(1); assertThat(cursors.count(MMS)).isEqualTo(4); assertThat(cursors.count(CALLLOG)).isEqualTo(0); assertThat(cursors.count(null)).isEqualTo(0); }