### Question:
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent, ItemHierarchy.Observer { public void clear() { if (children.isEmpty()) { return; } final int numRemoved = getCount(); for (ItemHierarchy item : children) { item.unregisterObserver(this); } dirty = true; children.clear(); notifyItemRangeRemoved(0, numRemoved); } 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 testClear() { itemGroup.addChild(CHILD_1); itemGroup.addChild(CHILD_2); itemGroup.clear(); assertWithMessage("Should have 0 child").that(itemGroup.getCount()).isEqualTo(0); verify(observer).onItemRangeRemoved(eq(itemGroup), eq(0), eq(2)); }