@Test public void onBindViewHolder() { UniversalAdapter adapter = Mockito.spy(new UniversalAdapter(mBuilder1, mBuilder2)); Model1 one = new Model1(); adapter.add(one); DefaultViewHolder holder = Mockito.mock(DefaultViewHolder.class); adapter.onBindViewHolder(holder, 0); Mockito.verify(holder).bind(one); }
@SuppressWarnings("unchecked") @Override public void onBindViewHolder(@NonNull DefaultViewHolder holder, int position) { holder.bind(getItem(position)); }
UniversalAdapter extends RecyclerView.Adapter<DefaultViewHolder> { @SuppressWarnings("unchecked") @Override public void onBindViewHolder(@NonNull DefaultViewHolder holder, int position) { holder.bind(getItem(position)); } }
UniversalAdapter extends RecyclerView.Adapter<DefaultViewHolder> { @SuppressWarnings("unchecked") @Override public void onBindViewHolder(@NonNull DefaultViewHolder holder, int position) { holder.bind(getItem(position)); } UniversalAdapter(Builder... builders);  UniversalAdapter(List<Builder> builders); }
UniversalAdapter extends RecyclerView.Adapter<DefaultViewHolder> { @SuppressWarnings("unchecked") @Override public void onBindViewHolder(@NonNull DefaultViewHolder holder, int position) { holder.bind(getItem(position)); } UniversalAdapter(Builder... builders);  UniversalAdapter(List<Builder> builders); @Override @NonNull DefaultViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType); @SuppressWarnings("unchecked") @Override void onBindViewHolder(@NonNull DefaultViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); int getItemCount(Class itemClass); void add(int pos, ViewModelWrapper wrapper); void replace(int index, Object item, int holderId); void replace(int index, Object item); boolean add(ViewModelWrapper wrapper); void add(Object item, int builderId); boolean add(Object item); boolean add(int index, Object item); void add(int index, Object item, int builderId); Object getItem(int position); void addAll(List items); void addAll(List items, int builderId); void replaceAll(List items); void replaceAll(List items, int builderId); void addAllWrappers(List<ViewModelWrapper> items); void replaceAllWrappers(List<ViewModelWrapper> elements); void removeItems(int startIndex, int endIndex); boolean clear(); int indexOf(Object searchItem); }
UniversalAdapter extends RecyclerView.Adapter<DefaultViewHolder> { @SuppressWarnings("unchecked") @Override public void onBindViewHolder(@NonNull DefaultViewHolder holder, int position) { holder.bind(getItem(position)); } UniversalAdapter(Builder... builders);  UniversalAdapter(List<Builder> builders); @Override @NonNull DefaultViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType); @SuppressWarnings("unchecked") @Override void onBindViewHolder(@NonNull DefaultViewHolder holder, int position); @Override int getItemViewType(int position); @Override int getItemCount(); int getItemCount(Class itemClass); void add(int pos, ViewModelWrapper wrapper); void replace(int index, Object item, int holderId); void replace(int index, Object item); boolean add(ViewModelWrapper wrapper); void add(Object item, int builderId); boolean add(Object item); boolean add(int index, Object item); void add(int index, Object item, int builderId); Object getItem(int position); void addAll(List items); void addAll(List items, int builderId); void replaceAll(List items); void replaceAll(List items, int builderId); void addAllWrappers(List<ViewModelWrapper> items); void replaceAllWrappers(List<ViewModelWrapper> elements); void removeItems(int startIndex, int endIndex); boolean clear(); int indexOf(Object searchItem);  }