@Test public void addData() { background.addData(1); assertThatThrownBy(() -> background.addData(-1)) .isInstanceOf(IndexOutOfBoundsException.class); assertThatThrownBy(() -> background.addData(3)) .isInstanceOf(IndexOutOfBoundsException.class); }
@Override public BackgroundData addData(int index) { if (index < 0 || index > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("Index out of range ").append(index).toString()); } BackgroundData backgroundData = new BackgroundData(); scesimData.add(index, backgroundData); return backgroundData; }
Background extends AbstractScesimModel<BackgroundData> { @Override public BackgroundData addData(int index) { if (index < 0 || index > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("Index out of range ").append(index).toString()); } BackgroundData backgroundData = new BackgroundData(); scesimData.add(index, backgroundData); return backgroundData; } }
Background extends AbstractScesimModel<BackgroundData> { @Override public BackgroundData addData(int index) { if (index < 0 || index > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("Index out of range ").append(index).toString()); } BackgroundData backgroundData = new BackgroundData(); scesimData.add(index, backgroundData); return backgroundData; }  }
Background extends AbstractScesimModel<BackgroundData> { @Override public BackgroundData addData(int index) { if (index < 0 || index > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("Index out of range ").append(index).toString()); } BackgroundData backgroundData = new BackgroundData(); scesimData.add(index, backgroundData); return backgroundData; }  List<BackgroundDataWithIndex> getBackgroundDataWithIndex(); @Override BackgroundData addData(int index); @Override Background cloneModel(); }
Background extends AbstractScesimModel<BackgroundData> { @Override public BackgroundData addData(int index) { if (index < 0 || index > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("Index out of range ").append(index).toString()); } BackgroundData backgroundData = new BackgroundData(); scesimData.add(index, backgroundData); return backgroundData; }  List<BackgroundDataWithIndex> getBackgroundDataWithIndex(); @Override BackgroundData addData(int index); @Override Background cloneModel();  }