/**
* Check that inserting and retrieving values works as expected.
*/
public void testInsertAndRetrieve() {
KeyedObjects data = new KeyedObjects();
data.addObject("A", new Double(1.0));
data.addObject("B", new Double(2.0));
data.addObject("C", new Double(3.0));
data.addObject("D", null);
// check key order
assertEquals(data.getKey(0), "A");
assertEquals(data.getKey(1), "B");
assertEquals(data.getKey(2), "C");
assertEquals(data.getKey(3), "D");
// check retrieve value by key
assertEquals(data.getObject("A"), new Double(1.0));
assertEquals(data.getObject("B"), new Double(2.0));
assertEquals(data.getObject("C"), new Double(3.0));
assertEquals(data.getObject("D"), null);
assertEquals(data.getObject("Not a key"), null);
// check retrieve value by index
assertEquals(data.getObject(0), new Double(1.0));
assertEquals(data.getObject(1), new Double(2.0));
assertEquals(data.getObject(2), new Double(3.0));
assertEquals(data.getObject(3), null);
}