### Question:
DefaultKeyedValues implements KeyedValues, Cloneable,
        PublicCloneable, Serializable { @Override public int getIndex(Comparable key) { if (key == null) { throw new IllegalArgumentException("Null 'key' argument."); } final Integer i = this.indexMap.get(key); if (i == null) { return -1; } return i; } 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 testGetIndex() { DefaultKeyedValues v1 = new DefaultKeyedValues(); assertEquals(-1, v1.getIndex("K1")); DefaultKeyedValues v2 = new DefaultKeyedValues(); v2.addValue("K1", new Integer(1)); v2.addValue("K2", new Integer(2)); v2.addValue("K3", new Integer(3)); assertEquals(2, v2.getIndex("K3")); try { v2.getIndex(null); fail("Should have thrown an IllegalArgumentException on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'key' argument.", e.getMessage()); } }