@Test public void testAddingEvent() { ListDataListener mockListener = createStrictMock(ListDataListener.class); mockListener.intervalAdded( ListDataEventMatcher.eqListDataEvent( new ListDataEvent(d_filledList, ListDataEvent.INTERVAL_ADDED, 1, 1))); replay(mockListener); d_filledList.addListDataListener(mockListener); d_filledList.add("Douwe"); verify(mockListener); }
@Test public void testDeletingEvent() { d_filledList.add("Douwe"); ListDataListener mockListener = createStrictMock(ListDataListener.class); mockListener.intervalRemoved( ListDataEventMatcher.eqListDataEvent( new ListDataEvent(d_filledList, ListDataEvent.INTERVAL_REMOVED, 1, 1))); replay(mockListener); d_filledList.addListDataListener(mockListener); d_filledList.remove("Douwe"); verify(mockListener); }