@Test
public void testStackedConfigsDoNotModifyUnderlyingDataSeries() {

  final int dataCount = 10;
  LineChartModel model = new LineChartModel();
  DefaultDataSeries<Long> series1 = new DefaultDataSeries<>();
  DefaultDataSeries<Long> series2 = new DefaultDataSeries<>();
  for (int i = 0; i <= dataCount; i++) {
    series1.add(i, (long)i);
    series2.add(i, (long)i);
  }
  RangedContinuousSeries rangedSeries1 = new RangedContinuousSeries("series1", new Range(0, dataCount), new Range(0, 0), series1);
  RangedContinuousSeries rangedSeries2 = new RangedContinuousSeries("series2", new Range(0, dataCount), new Range(0, 0), series2);
  model.add(rangedSeries1);
  model.add(rangedSeries2);
  LineChart chart = new LineChart(model);
  chart.configure(rangedSeries1, new LineConfig(Color.BLACK).setStacked(true));
  chart.configure(rangedSeries2, new LineConfig(Color.WHITE).setStacked(true));
  model.update(TimeUnit.SECONDS.toNanos(1));
  chart.setSize(100, 100);
  Graphics2D fakeGraphics = mock(Graphics2D.class);
  when(fakeGraphics.create()).thenReturn(fakeGraphics);
  chart.paint(fakeGraphics);
  for (int i = 0; i < dataCount; i++) {
    assertThat(series1.getY(i)).isEqualTo(i);
    assertThat(series2.getY(i)).isEqualTo(i);
  }
}