### Question:
KeyedObjects implements Cloneable, PublicCloneable, Serializable { public Object getObject(int item) { Object result = null; KeyedObject kobj = this.data.get(item); if (kobj != null) { result = kobj.getObject(); } return result; } KeyedObjects(); int getItemCount(); Object getObject(int item); Comparable getKey(int index); int getIndex(Comparable key); List<Comparable> getKeys(); Object getObject(Comparable key); void addObject(Comparable key, Object object); void setObject(Comparable key, Object object); void insertValue(int position, Comparable key, Object value); void removeValue(int index); void removeValue(Comparable key); void clear(); @Override Object clone(); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testGetObject() { KeyedObjects ko1 = new KeyedObjects(); ko1.addObject("Key 1", "Object 1"); ko1.addObject("Key 2", null); ko1.addObject("Key 3", "Object 2"); assertEquals("Object 1", ko1.getObject(0)); assertNull(ko1.getObject(1)); assertEquals("Object 2", ko1.getObject(2)); try { ko1.getObject(-1); fail("Should have thrown IndexOutOfBoundsException on negative key"); } catch (IndexOutOfBoundsException e) { assertEquals("-1", e.getMessage()); } try { ko1.getObject(3); fail("Should have thrown IndexOutOfBoundsException on key out of range"); } catch (IndexOutOfBoundsException e) { assertEquals("Index: 3, Size: 3", e.getMessage()); } }