### Question:
AddEpochsPresentation extends AddListItemsPresentation<Epoch> { @Override public void rename(int idx, String newName) { Epoch oldEpoch = d_list.get(idx); d_study.replaceEpoch(oldEpoch, oldEpoch.rename(newName)); } AddEpochsPresentation(Study study, String itemName, int minElements); @Override ObservableList<Note> getNotes(Epoch t); @Override ValueModel getRemovable(final Epoch t); @Override Epoch createItem(); DurationPresentation<Epoch> getDurationModel(int idx); @Override void rename(int idx, String newName); void setStudy(Study study); Study getStudy();  }### Answer:
@Test public void testRename() { AddEpochsPresentation presentation = new AddEpochsPresentation(d_study, "Epoch", 1); ListDataListener mockListener = EasyMock.createStrictMock(ListDataListener.class); mockListener.contentsChanged(ListDataEventMatcher.eqListDataEvent( new ListDataEvent(d_study.getEpochs(), ListDataEvent.CONTENTS_CHANGED, 0, 0))); EasyMock.replay(mockListener); d_study.getEpochs().addListDataListener(mockListener); final String newName = "Other epoch"; presentation.rename(0, newName); EasyMock.verify(mockListener); assertEquals(newName, d_study.getEpochs().get(0).getName()); assertEquals(newName, presentation.getList().get(0).getName()); }