RepositoryAdapter extends RecyclerView.Adapter<ViewHolder> implements Updatable { @Override public final int getItemViewType(final int position) { resolveIndices(position); return parts[resolvedPartIndex].getLayoutResId(resolvedItemIndex); } RepositoryAdapter(@NonNull final Builder builder); @NonNull static Builder repositoryAdapter(); final void startObserving(); final void stopObserving(); @Override final void update(); @Override final int getItemCount(); @Override final int getItemViewType(final int position); @Override final long getItemId(final int position); @Override ViewHolder onCreateViewHolder(final ViewGroup parent,
      final int layoutResourceId); @Override final void onBindViewHolder(final ViewHolder holder, final int position); @Override boolean onFailedToRecycleView(final ViewHolder holder); @Override void onViewRecycled(final ViewHolder holder);  }
@Test public void shouldReturnItemViewTypeFromFirstPresenter() { when(repositoryPresenter.getLayoutResId(REPOSITORY_ITEM, 0)).thenReturn(1); assertThat(repositoryAdapter.getItemViewType(0), is(1)); }
@Test public void shouldReturnItemViewTypeFromSecondPresenter() { when(secondRepositoryPresenter.getLayoutResId(REPOSITORY_LIST, 0)).thenReturn(2); assertThat(repositoryAdapter.getItemViewType(1), is(2)); }
@Test public void shouldReturnItemViewTypeFromLayoutPresenter() { when(layoutPresenter.getLayoutResId()).thenReturn(34); assertThat(repositoryAdapter.getItemViewType(4), is(34)); }
@Test public void shouldReturnItemViewTypeFromItemPresenter() { when(multiItemRepositoryPresenter.getLayoutResId(ITEM, 2)).thenReturn(42); assertThat(repositoryAdapter.getItemViewType(8), is(42)); }