AbstractScesimModel { public T cloneData(int sourceIndex, int targetIndex) { if (sourceIndex < 0 || sourceIndex >= scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("SourceIndex out of range ").append(sourceIndex).toString()); } if (targetIndex < 0 || targetIndex > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("TargetIndex out of range ").append(targetIndex).toString()); } T scesimDataByIndex = getDataByIndex(sourceIndex); T clonedScesimData = (T) scesimDataByIndex.cloneInstance(); scesimData.add(targetIndex, clonedScesimData); return clonedScesimData; }  abstract AbstractScesimModel<T> cloneModel(); abstract T addData(int index); List<T> getUnmodifiableData(); void removeDataByIndex(int index); void removeData(T toRemove); T getDataByIndex(int index); T addData(); void replaceData(int index, T newScesimData); T cloneData(int sourceIndex, int targetIndex); void clear(); void clearDatas(); void resetErrors(); ScesimModelDescriptor getScesimModelDescriptor(); void removeFactMappingByIndex(int index); void removeFactMapping(FactMapping toRemove);  }
@Test public void cloneData() { assertEquals(SCENARIO_DATA, abstractScesimModelSpy.scesimData.size()); final Scenario cloned = abstractScesimModelSpy.getDataByIndex(3); final Scenario clone = abstractScesimModelSpy.cloneData(3, 4); assertNotNull(clone); assertEquals(clone, abstractScesimModelSpy.scesimData.get(4)); assertEquals(cloned.getDescription(), clone.getDescription()); }