### Question:
DefaultPieDataset extends AbstractDataset implements PieDataset, Cloneable, PublicCloneable, Serializable { public void clear() { if (getItemCount() > 0) { this.data.clear(); fireDatasetChanged(); } } DefaultPieDataset();  DefaultPieDataset(KeyedValues data); @Override int getItemCount(); @Override List<Comparable> getKeys(); @Override Comparable getKey(int item); @Override int getIndex(Comparable key); @Override Number getValue(int item); @Override Number getValue(Comparable key); void setValue(Comparable key, Number value); void setValue(Comparable key, double value); void insertValue(int position, Comparable key, double value); void insertValue(int position, Comparable key, Number value); void remove(Comparable key); void clear(); void sortByKeys(SortOrder order); void sortByValues(SortOrder order); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testClear() { DefaultPieDataset d = new DefaultPieDataset(); d.addChangeListener(this); d.clear(); assertNull(this.lastEvent); d.setValue("A", 1.0); assertEquals(1, d.getItemCount()); this.lastEvent = null; d.clear(); assertNotNull(this.lastEvent); assertEquals(0, d.getItemCount()); }