### Question:
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent, ItemHierarchy.Observer { public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(children, child); final int childPosition = getChildPosition(childIndex); dirty = true; if (childIndex != -1) { final int childCount = child.getCount(); children.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; } ItemGroup();  ItemGroup(Context context, AttributeSet attrs); @Override void addChild(ItemHierarchy child); boolean removeChild(ItemHierarchy child); void clear(); @Override int getCount(); @Override IItem getItemAt(int position); @Override void onChanged(ItemHierarchy hierarchy); @Override void onItemRangeChanged(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeInserted(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeMoved(
      ItemHierarchy itemHierarchy, int fromPosition, int toPosition, int itemCount); @Override void onItemRangeRemoved(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override ItemHierarchy findItemById(int id);  }### Answer:
@Test public void testRemoveChild() { itemGroup.addChild(CHILD_1); itemGroup.addChild(CHILD_2); itemGroup.addChild(CHILD_3); itemGroup.removeChild(CHILD_2); assertWithMessage("Item at position 0 should be child1") .that(itemGroup.getItemAt(0)) .isSameAs(CHILD_1); assertWithMessage("Item at position 1 should be child3") .that(itemGroup.getItemAt(1)) .isSameAs(CHILD_3); assertWithMessage("Should have 2 children").that(itemGroup.getCount()).isEqualTo(2); verify(observer).onItemRangeRemoved(eq(itemGroup), eq(1), eq(1)); }