### Question:
DefaultKeyedValues implements KeyedValues, Cloneable,
        PublicCloneable, Serializable { public void removeValue(int index) { this.keys.remove(index); this.values.remove(index); rebuildIndex(); } DefaultKeyedValues(); @Override int getItemCount(); @Override Number getValue(int item); @Override Comparable getKey(int index); @Override int getIndex(Comparable key); @Override List<Comparable> getKeys(); @Override Number getValue(Comparable key); void addValue(Comparable key, double value); void addValue(Comparable key, Number value); void setValue(Comparable key, double value); void setValue(Comparable key, Number value); void insertValue(int position, Comparable key, double value); void insertValue(int position, Comparable key, Number value); void removeValue(int index); void removeValue(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 testRemoveValue() { DefaultKeyedValues data = new DefaultKeyedValues(); data.addValue("A", new Double(1.0)); data.addValue("B", null); data.addValue("C", new Double(3.0)); data.addValue("D", new Double(2.0)); assertEquals(1, data.getIndex("B")); data.removeValue("B"); assertEquals(-1, data.getIndex("B")); try { data.removeValue("XXX"); fail("Should have thrown an UnknownKeyException"); } catch (UnknownKeyException e) { assertEquals("The key (XXX) is not recognised.", e.getMessage()); } }