### Question:
DefaultKeyedValues implements KeyedValues, Cloneable,
        PublicCloneable, Serializable { @Override public Comparable getKey(int index) { return this.keys.get(index); } 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 testGetKey() { DefaultKeyedValues v1 = new DefaultKeyedValues(); try { v1.getKey(-1); fail("Should have thrown an IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { v1.getKey(0); fail("Should have thrown an IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } DefaultKeyedValues v2 = new DefaultKeyedValues(); v2.addValue("K1", new Integer(1)); v2.addValue("K2", new Integer(2)); v2.addValue("K3", new Integer(3)); assertEquals("K2", v2.getKey(1)); }