@Test public void testFromAlphabeticCursorThatCannotBeMovedToFirstPosition() { final TestCursor mockCursor = mock(TestCursor.class); final AlphabeticHeaders.ModuleAdapter mockAdapter = mock(AlphabeticHeaders.ModuleAdapter.class); final Module module = new Module(); module.attachToAdapter(mockAdapter); when(mockCursor.getCount()).thenReturn(10); when(mockCursor.moveToFirst()).thenReturn(false); module.fromAlphabeticCursor(mockCursor); assertThat(module.size(), is(0)); verify(mockAdapter).notifyDataSetChanged(); verifyNoMoreInteractions(mockAdapter); }
public <C extends Cursor & AlphabeticItem> void fromAlphabeticCursor(@NonNull final C cursor) { clearHeaders(); if (cursor.getCount() > 0 && cursor.moveToFirst()) { do { onProcessItem(cursor.getPosition(), cursor); } while (cursor.moveToNext()); } notifyAdapter(); }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <C extends Cursor & AlphabeticItem> void fromAlphabeticCursor(@NonNull final C cursor) { clearHeaders(); if (cursor.getCount() > 0 && cursor.moveToFirst()) { do { onProcessItem(cursor.getPosition(), cursor); } while (cursor.moveToNext()); } notifyAdapter(); } }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <C extends Cursor & AlphabeticItem> void fromAlphabeticCursor(@NonNull final C cursor) { clearHeaders(); if (cursor.getCount() > 0 && cursor.moveToFirst()) { do { onProcessItem(cursor.getPosition(), cursor); } while (cursor.moveToNext()); } notifyAdapter(); }  }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <C extends Cursor & AlphabeticItem> void fromAlphabeticCursor(@NonNull final C cursor) { clearHeaders(); if (cursor.getCount() > 0 && cursor.moveToFirst()) { do { onProcessItem(cursor.getPosition(), cursor); } while (cursor.moveToNext()); } notifyAdapter(); }  void fromAlphabeticCursor(@NonNull final C cursor); void fromAlphabeticCollection(@NonNull final Collection<Item> collection); @Override @CallSuper void clearHeaders(); }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <C extends Cursor & AlphabeticItem> void fromAlphabeticCursor(@NonNull final C cursor) { clearHeaders(); if (cursor.getCount() > 0 && cursor.moveToFirst()) { do { onProcessItem(cursor.getPosition(), cursor); } while (cursor.moveToNext()); } notifyAdapter(); }  void fromAlphabeticCursor(@NonNull final C cursor); void fromAlphabeticCollection(@NonNull final Collection<Item> collection); @Override @CallSuper void clearHeaders();  }