### Question:
GroupAdapterViewTypeDelegate extends AdapterViewTypeDelegate<HOLDER, List<ViewItem>> { @Override public void unbindViewHolder(HOLDER holder) { ViewGroup rootViewGroup = getRootViewGroup(holder); if (rootViewGroup.getChildCount() == 0) { return; } for (int i = 0; i < rootViewGroup.getChildCount(); i++) { unbindChildView(rootViewGroup.getChildAt(i)); } rootViewGroup.removeAllViews(); } GroupAdapterViewTypeDelegate(List<AdapterViewTypeDelegate> delegates); @Override void bindViewHolder(HOLDER holder, List<ViewItem> viewItems); @Override void bindViewHolder(HOLDER holder, List<ViewItem> viewItems, List<Object> payloads); @Override void unbindViewHolder(HOLDER holder); @Override DiffUtilComparator<List<ViewItem>> createDiffUtilComparator();  }### Answer:
@Test public void unbindViewHolder_shouldDoNothing_whenProcessingAFreshViewHolder() { List<AdapterViewTypeDelegate> delegates = singletonList(createValidAdapterViewTypeDelegate(0)); GroupViewHolder groupHolder = createGroupViewHolder(); replayAll(); TargetGroupAdapterViewTypeDelegate target = new TargetGroupAdapterViewTypeDelegate(delegates); target.unbindViewHolder(groupHolder); verifyAll(); }
@Test public void unbindViewHolder_shouldClearViewHolder_whenProcessingExistingViewHolder() { List<AdapterViewTypeDelegate> delegates = singletonList(createValidAdapterViewTypeDelegate(0)); GroupViewHolder groupHolder = createGroupViewHolder(); List<ViewItem> viewItems = singletonList(createViewItem(new ChildModel(0, ""), 0)); List<RecyclerView.ViewHolder> childViewHolders = singletonList(createChildViewHolder("0")); TargetGroupAdapterViewTypeDelegate target = createTargetDelegateWithState(delegates, viewItems, childViewHolders, groupHolder); delegates.get(0).unbindViewHolder(childViewHolders.get(0)); replayAll(); target.unbindViewHolder(groupHolder); assertThat(groupHolder.viewGroup.getChildCount(), is(0)); verifyAll(); }