@Test
public void threadDiesBeforeRangeMax() {

  Range range = new Range(TimeUnit.SECONDS.toMicros(10), TimeUnit.SECONDS.toMicros(20));
  List<SeriesData<Long>> seriesDataList = myDataSeries.getDataForRange(range);
  assertEquals(3, seriesDataList.size());
  // Threads count by thread2 state change to RUNNING
  SeriesData<Long> seriesData = seriesDataList.get(0);
  Objects.requireNonNull(seriesData);
  // In the new pipeline, we only return the -1 thread state, so the timestamp of that event is 8 instead of the first thread state
  // activity at t = 6.
  long timestamp = myIsUnifiedPipeline ? TimeUnit.SECONDS.toMicros(8) : TimeUnit.SECONDS.toMicros(6);
  assertEquals(timestamp, seriesData.x, 0);
  assertEquals(1, (long)seriesData.value); // thread2 is alive
  // Threads count by thread2 state change to DEAD
  seriesData = seriesDataList.get(1);
  Objects.requireNonNull(seriesData);
  assertEquals(TimeUnit.SECONDS.toMicros(15), seriesData.x, 0);
  assertEquals(0, (long)seriesData.value); // thread2 is dead now
  // Threads count by range.getMax(). This value is added when range.getMax()
  // is greater than the timestamp of the thread state change to DEAD
  seriesData = seriesDataList.get(2);
  Objects.requireNonNull(seriesData);
  assertEquals(range.getMax(), seriesData.x, 0);
  assertEquals(0, (long)seriesData.value); // thread2 is still dead
}