### Question:
DefaultMultiValueCategoryDataset extends AbstractDataset implements MultiValueCategoryDataset, RangeInfo, PublicCloneable { @Override public Number getValue(Comparable row, Comparable column) { List<Number> l = (List<Number>) this.data.getObject(row, column); double average = 0.0d; int count = 0; if (l != null && l.size() > 0) { for (Number n : l) { average += n.doubleValue(); count += 1; } if (count > 0) { average = average / count; } } if (count == 0) { return null; } return average; } DefaultMultiValueCategoryDataset(); void add(List<Number> values, Comparable rowKey, Comparable columnKey); @Override List<Number> getValues(int row, int column); @Override List<Number> getValues(Comparable rowKey, Comparable columnKey); @Override Number getValue(Comparable row, Comparable column); @Override Number getValue(int row, int column); @Override int getColumnIndex(Comparable key); @Override Comparable getColumnKey(int column); @Override List<Comparable> getColumnKeys(); @Override int getRowIndex(Comparable key); @Override Comparable getRowKey(int row); @Override List<Comparable> getRowKeys(); @Override int getRowCount(); @Override int getColumnCount(); @Override double getRangeLowerBound(boolean includeInterval); @Override double getRangeUpperBound(boolean includeInterval); @Override Range getRangeBounds(boolean includeInterval); @Override boolean equals(Object obj); @Override Object clone();  }### Answer:
@Test public void testGetValue() { DefaultMultiValueCategoryDataset d = new DefaultMultiValueCategoryDataset(); List<Number> values = new ArrayList<Number>(); values.add(1); values.add(2); d.add(values, "R1", "C1"); assertEquals(1.5, d.getValue("R1", "C1")); try { d.getValue("XX", "C1"); fail("UnknownKeyException should have been thrown on an unknown key"); } catch (UnknownKeyException e) { assertEquals("Row key (XX) not recognised.", e.getMessage()); } try { d.getValue("R1", "XX"); fail("UnknownKeyException should have been thrown on an unknown key"); } catch (UnknownKeyException e) { assertEquals("Column key (XX) not recognised.", e.getMessage()); } }
@Test public void testGetValue2() { DefaultMultiValueCategoryDataset d = new DefaultMultiValueCategoryDataset(); try { d.getValue(0, 0); fail("IndexOutOfBoundsException should have been thrown on key out of range"); } catch (IndexOutOfBoundsException e) { assertEquals("Index: 0, Size: 0", e.getMessage()); } }