Program: 38859
Project: 38859
Buggy source:
@Test public void test() throws IOException {
  RegularTimeSeriesIndex index=RegularTimeSeriesIndex.create(Interval.parse("String_Node_Str"),Duration.ofMinutes(15));
  TimeSeriesMetadata metadata=new TimeSeriesMetadata("String_Node_Str",TimeSeriesDataType.DOUBLE,Collections.emptyMap(),index);
  UncompressedDoubleArrayChunk chunk=new UncompressedDoubleArrayChunk(2,new double[]{1d,2d});
  CompressedDoubleArrayChunk chunk2=new CompressedDoubleArrayChunk(5,3,new double[]{3d,4d},new int[]{1,2});
  assertEquals(TimeSeriesDataType.DOUBLE,chunk.getDataType());
  StoredDoubleTimeSeries timeSeries=new StoredDoubleTimeSeries(metadata,chunk,chunk2);
  assertSame(metadata,timeSeries.getMetadata());
  assertEquals(Arrays.asList(chunk,chunk2),timeSeries.getChunks());
  assertArrayEquals(new double[]{Double.NaN,Double.NaN,1d,2d,Double.NaN,3d,4d,4d},timeSeries.toArray(),0d);
  DoublePoint[] pointsRef={new DoublePoint(0,Instant.parse("String_Node_Str").toEpochMilli(),Double.NaN),new DoublePoint(2,Instant.parse("String_Node_Str").toEpochMilli(),1d),new DoublePoint(3,Instant.parse("String_Node_Str").toEpochMilli(),2d),new DoublePoint(4,Instant.parse("String_Node_Str").toEpochMilli(),Double.NaN),new DoublePoint(5,Instant.parse("String_Node_Str").toEpochMilli(),3d),new DoublePoint(6,Instant.parse("String_Node_Str").toEpochMilli(),4d)};
  assertArrayEquals(pointsRef,timeSeries.stream().toArray());
  assertArrayEquals(pointsRef,Iterators.toArray(timeSeries.iterator(),DoublePoint.class));
  String jsonRef=String.join(System.lineSeparator(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  String json=JsonUtil.toJson(timeSeries::writeJson);
  assertEquals(jsonRef,json);
  List<TimeSeries> timeSeriesList=TimeSeries.parseJson(json);
  assertEquals(1,timeSeriesList.size());
  String json2=JsonUtil.toJson(timeSeriesList.get(0)::writeJson);
  assertEquals(json,json2);
  ObjectMapper objectMapper=new ObjectMapper().registerModule(new TimeSeriesJsonModule());
  assertEquals(timeSeries,objectMapper.readValue(objectMapper.writeValueAsString(timeSeries),DoubleTimeSeries.class));
}

Fixed version (ground truth):
@Test public void test() throws IOException {
  RegularTimeSeriesIndex index=RegularTimeSeriesIndex.create(Interval.parse("String_Node_Str"),Duration.ofMinutes(15));
  TimeSeriesMetadata metadata=new TimeSeriesMetadata("String_Node_Str",TimeSeriesDataType.DOUBLE,Collections.emptyMap(),index);
  UncompressedDoubleArrayChunk chunk=new UncompressedDoubleArrayChunk(2,new double[]{1d,2d});
  CompressedDoubleArrayChunk chunk2=new CompressedDoubleArrayChunk(5,3,new double[]{3d,4d},new int[]{1,2});
  assertEquals(TimeSeriesDataType.DOUBLE,chunk.getDataType());
  StoredDoubleTimeSeries timeSeries=new StoredDoubleTimeSeries(metadata,chunk,chunk2);
  assertSame(metadata,timeSeries.getMetadata());
  assertEquals(Arrays.asList(chunk,chunk2),timeSeries.getChunks());
  assertArrayEquals(new double[]{Double.NaN,Double.NaN,1d,2d,Double.NaN,3d,4d,4d},timeSeries.toArray(),0d);
  DoublePoint[] pointsRef={new DoublePoint(0,Instant.parse("String_Node_Str").toEpochMilli(),Double.NaN),new DoublePoint(2,Instant.parse("String_Node_Str").toEpochMilli(),1d),new DoublePoint(3,Instant.parse("String_Node_Str").toEpochMilli(),2d),new DoublePoint(4,Instant.parse("String_Node_Str").toEpochMilli(),Double.NaN),new DoublePoint(5,Instant.parse("String_Node_Str").toEpochMilli(),3d),new DoublePoint(6,Instant.parse("String_Node_Str").toEpochMilli(),4d)};
  assertArrayEquals(pointsRef,timeSeries.stream().toArray());
  assertArrayEquals(pointsRef,Iterators.toArray(timeSeries.iterator(),DoublePoint.class));
  String jsonRef=String.join(System.lineSeparator(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  String json=JsonUtil.toJson(timeSeries::writeJson);
  assertEquals(jsonRef,json);
  List<TimeSeries> timeSeriesList=TimeSeries.parseJson(json);
  assertEquals(1,timeSeriesList.size());
  String json2=JsonUtil.toJson(timeSeriesList.get(0)::writeJson);
  assertEquals(json,json2);
  ObjectMapper objectMapper=JsonUtil.createObjectMapper().registerModule(new TimeSeriesJsonModule());
  assertEquals(timeSeries,objectMapper.readValue(objectMapper.writeValueAsString(timeSeries),DoubleTimeSeries.class));
}