assertEquals(3, testListener.addEvent.getIndex1());
assertEquals(ListDataEvent.INTERVAL_ADDED, testListener.addEvent.getType());
}
public void testAddAtIndex() {
DefaultListModel listModel = new DefaultListModel(new Object[]{"alpha", "bravo", "charlie"});
TestListDataListener testListener = new TestListDataListener();
listModel.addListDataListener(testListener);
listModel.add(2, "delta");
assertEquals(4, listModel.size());
assertEquals("alpha", listModel.get(0));
assertEquals("bravo", listModel.get(1));
assertEquals("delta", listModel.get(2));
assertEquals("charlie", listModel.get(3));
assertNull(testListener.changeEvent);
assertNull(testListener.removeEvent);
assertNotNull(testListener.addEvent);
assertEquals(listModel, testListener.addEvent.getSource());
assertEquals(2, testListener.addEvent.getIndex0());