Program: 38858
Project: 38858
Buggy source:
@Test public void compressTest() throws IOException {
  UncompressedDoubleArrayChunk chunk=new UncompressedDoubleArrayChunk(1,new double[]{1d,2d,2d,2d,2d,3d});
  DoubleArrayChunk maybeCompressedChunk=chunk.tryToCompress();
  assertTrue(maybeCompressedChunk instanceof CompressedDoubleArrayChunk);
  CompressedDoubleArrayChunk compressedChunk=(CompressedDoubleArrayChunk)maybeCompressedChunk;
  assertEquals(1,compressedChunk.getOffset());
  assertEquals(6,compressedChunk.getLength());
  assertTrue(compressedChunk.isCompressed());
  assertEquals(36,compressedChunk.getEstimatedSize());
  assertEquals(36d / 48,compressedChunk.getCompressionFactor(),0d);
  assertArrayEquals(new double[]{1d,2d,3d},compressedChunk.getStepValues(),0d);
  assertArrayEquals(new int[]{1,4,1},compressedChunk.getStepLengths());
  DoubleBuffer buffer=DoubleBuffer.allocate(7);
  for (int i=0; i < 7; i++) {
    buffer.put(i,Double.NaN);
  }
  compressedChunk.fillBuffer(buffer,0);
  assertArrayEquals(new double[]{Double.NaN,1d,2d,2d,2d,2d,3d},buffer.array(),0d);
  String jsonRef=String.join(System.lineSeparator(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(jsonRef,JsonUtil.toJson(compressedChunk::writeJson));
  ObjectMapper objectMapper=new ObjectMapper().registerModule(new TimeSeriesJsonModule());
  List<DoubleArrayChunk> chunks=objectMapper.readValue(objectMapper.writeValueAsString(Arrays.asList(chunk,compressedChunk)),TypeFactory.defaultInstance().constructCollectionType(List.class,DoubleArrayChunk.class));
  assertEquals(2,chunks.size());
  assertEquals(chunk,chunks.get(0));
  assertEquals(compressedChunk,chunks.get(1));
  assertTrue(objectMapper.readValue(objectMapper.writeValueAsString(chunk),ArrayChunk.class) instanceof DoubleArrayChunk);
  RegularTimeSeriesIndex index=RegularTimeSeriesIndex.create(Interval.parse("String_Node_Str"),Duration.ofMinutes(15));
  assertEquals(ImmutableList.of(new DoublePoint(1,Instant.parse("String_Node_Str").toEpochMilli(),1d),new DoublePoint(2,Instant.parse("String_Node_Str").toEpochMilli(),2d),new DoublePoint(6,Instant.parse("String_Node_Str").toEpochMilli(),3d)),compressedChunk.stream(index).collect(Collectors.toList()));
}

Fixed version (ground truth):
@Test public void compressTest() throws IOException {
  UncompressedDoubleArrayChunk chunk=new UncompressedDoubleArrayChunk(1,new double[]{1d,2d,2d,2d,2d,3d});
  DoubleArrayChunk maybeCompressedChunk=chunk.tryToCompress();
  assertTrue(maybeCompressedChunk instanceof CompressedDoubleArrayChunk);
  CompressedDoubleArrayChunk compressedChunk=(CompressedDoubleArrayChunk)maybeCompressedChunk;
  assertEquals(1,compressedChunk.getOffset());
  assertEquals(6,compressedChunk.getLength());
  assertTrue(compressedChunk.isCompressed());
  assertEquals(36,compressedChunk.getEstimatedSize());
  assertEquals(36d / 48,compressedChunk.getCompressionFactor(),0d);
  assertArrayEquals(new double[]{1d,2d,3d},compressedChunk.getStepValues(),0d);
  assertArrayEquals(new int[]{1,4,1},compressedChunk.getStepLengths());
  DoubleBuffer buffer=DoubleBuffer.allocate(7);
  for (int i=0; i < 7; i++) {
    buffer.put(i,Double.NaN);
  }
  compressedChunk.fillBuffer(buffer,0);
  assertArrayEquals(new double[]{Double.NaN,1d,2d,2d,2d,2d,3d},buffer.array(),0d);
  String jsonRef=String.join(System.lineSeparator(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(jsonRef,JsonUtil.toJson(compressedChunk::writeJson));
  ObjectMapper objectMapper=JsonUtil.createObjectMapper().registerModule(new TimeSeriesJsonModule());
  List<DoubleArrayChunk> chunks=objectMapper.readValue(objectMapper.writeValueAsString(Arrays.asList(chunk,compressedChunk)),TypeFactory.defaultInstance().constructCollectionType(List.class,DoubleArrayChunk.class));
  assertEquals(2,chunks.size());
  assertEquals(chunk,chunks.get(0));
  assertEquals(compressedChunk,chunks.get(1));
  assertTrue(objectMapper.readValue(objectMapper.writeValueAsString(chunk),ArrayChunk.class) instanceof DoubleArrayChunk);
  RegularTimeSeriesIndex index=RegularTimeSeriesIndex.create(Interval.parse("String_Node_Str"),Duration.ofMinutes(15));
  assertEquals(ImmutableList.of(new DoublePoint(1,Instant.parse("String_Node_Str").toEpochMilli(),1d),new DoublePoint(2,Instant.parse("String_Node_Str").toEpochMilli(),2d),new DoublePoint(6,Instant.parse("String_Node_Str").toEpochMilli(),3d)),compressedChunk.stream(index).collect(Collectors.toList()));
}