@Test public void testGetItemId() { final ListAdapter mockAdapter = mock(ListAdapter.class); final AdapterWrapper wrapper = new AdapterWrapper(mockAdapter); for (int i = 0; i < 30; i++) { when(mockAdapter.getItemId(i)).thenReturn(i + 1L); assertThat(wrapper.getItemId(i), is(i + 1L)); verify(mockAdapter).getItemId(i); } verifyNoMoreInteractions(mockAdapter); }
@Override public long getItemId(final int position) { return adapter == null ? -1 : adapter.getItemId(position); }
AdapterWrapper implements WrapperListAdapter { @Override public long getItemId(final int position) { return adapter == null ? -1 : adapter.getItemId(position); } }
AdapterWrapper implements WrapperListAdapter { @Override public long getItemId(final int position) { return adapter == null ? -1 : adapter.getItemId(position); } AdapterWrapper(@Nullable final ListAdapter adapter); }
AdapterWrapper implements WrapperListAdapter { @Override public long getItemId(final int position) { return adapter == null ? -1 : adapter.getItemId(position); } AdapterWrapper(@Nullable final ListAdapter adapter); @Override @Nullable ListAdapter getWrappedAdapter(); @Override void registerDataSetObserver(@NonNull final DataSetObserver observer); @Override void unregisterDataSetObserver(@NonNull final DataSetObserver observer); @Override boolean isEmpty(); @Override int getCount(); @Override @Nullable Object getItem(final int position); @Override boolean hasStableIds(); @Override long getItemId(final int position); @Override int getViewTypeCount(); @Override int getItemViewType(final int position); @Override View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent); @Override boolean areAllItemsEnabled(); @Override boolean isEnabled(final int position); }
AdapterWrapper implements WrapperListAdapter { @Override public long getItemId(final int position) { return adapter == null ? -1 : adapter.getItemId(position); } AdapterWrapper(@Nullable final ListAdapter adapter); @Override @Nullable ListAdapter getWrappedAdapter(); @Override void registerDataSetObserver(@NonNull final DataSetObserver observer); @Override void unregisterDataSetObserver(@NonNull final DataSetObserver observer); @Override boolean isEmpty(); @Override int getCount(); @Override @Nullable Object getItem(final int position); @Override boolean hasStableIds(); @Override long getItemId(final int position); @Override int getViewTypeCount(); @Override int getItemViewType(final int position); @Override View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent); @Override boolean areAllItemsEnabled(); @Override boolean isEnabled(final int position);  }