### Question:
DefaultCategoryDataset extends AbstractDataset implements CategoryDataset, PublicCloneable, Serializable { public void incrementValue(double value, Comparable rowKey, Comparable columnKey) { double existing = 0.0; Number n = getValue(rowKey, columnKey); if (n != null) { existing = n.doubleValue(); } setValue(existing + value, rowKey, columnKey); } DefaultCategoryDataset(); @Override int getRowCount(); @Override int getColumnCount(); @Override Number getValue(int row, int column); @Override Comparable getRowKey(int row); @Override int getRowIndex(Comparable key); @Override List<Comparable> getRowKeys(); @Override Comparable getColumnKey(int column); @Override int getColumnIndex(Comparable key); @Override List<Comparable> getColumnKeys(); @Override Number getValue(Comparable rowKey, Comparable columnKey); void addValue(Number value, Comparable rowKey,
                         Comparable columnKey); void addValue(double value, Comparable rowKey,
                         Comparable columnKey); void setValue(Number value, Comparable rowKey,
                         Comparable columnKey); void setValue(double value, Comparable rowKey,
                         Comparable columnKey); void incrementValue(double value,
                               Comparable rowKey,
                               Comparable columnKey); void removeValue(Comparable rowKey, Comparable columnKey); void removeRow(int rowIndex); void removeRow(Comparable rowKey); void removeColumn(int columnIndex); void removeColumn(Comparable columnKey); void clear(); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }### Answer:
@Test public void testIncrementValue() { DefaultCategoryDataset d = new DefaultCategoryDataset(); d.addValue(1.0, "R1", "C1"); d.incrementValue(2.0, "R1", "C1"); assertEquals(3.0, d.getValue("R1", "C1")); d.addValue(null, "R2", "C1"); d.incrementValue(2.0, "R2", "C1"); assertEquals(2.0, d.getValue("R2", "C1")); try { d.incrementValue(1.0, "XX", "C1"); fail("UnknownKeyException should have been thrown on unknown row"); } catch (UnknownKeyException e) { assertEquals("Unrecognised rowKey: XX", e.getMessage()); } try { d.incrementValue(1.0, "R1", "XX"); fail("UnknownKeyException should have been thrown on unknown row"); } catch (UnknownKeyException e) { assertEquals("Unrecognised columnKey: XX", e.getMessage()); } }