@Test
public void testGetDataForXRange() {

  myIdeProfilerServices.enableEventsPipeline(true);
  myTransportService.addEventToStream(ProfilersTestData.SESSION_DATA.getStreamId(),
                                      ProfilersTestData.generateMemoryHeapDumpData(INFO1.getStartTime(), INFO1.getStartTime(), INFO1)
                                        .setPid(ProfilersTestData.SESSION_DATA.getPid())
                                        .build());
  myTransportService.addEventToStream(ProfilersTestData.SESSION_DATA.getStreamId(),
                                      ProfilersTestData.generateMemoryHeapDumpData(INFO2.getStartTime(), INFO2.getStartTime(), INFO2)
                                        .setPid(ProfilersTestData.SESSION_DATA.getPid())
                                        .build());
  HeapDumpSampleDataSeries series =
    new HeapDumpSampleDataSeries(new ProfilerClient(myGrpcChannel.getName()), ProfilersTestData.SESSION_DATA,
                                 myIdeProfilerServices.getFeatureTracker(), myStage);
  List<SeriesData<CaptureDurationData<CaptureObject>>> dataList = series.getDataForRange(new Range(0, Double.MAX_VALUE));
  assertEquals(2, dataList.size());
  SeriesData<CaptureDurationData<CaptureObject>> data1 = dataList.get(0);
  assertEquals(2, data1.x);
  assertEquals(5, data1.value.getDurationUs());
  CaptureObject capture1 = data1.value.getCaptureEntry().getCaptureObject();
  assertEquals(TimeUnit.MICROSECONDS.toNanos(2), capture1.getStartTimeNs());
  assertEquals(TimeUnit.MICROSECONDS.toNanos(7), capture1.getEndTimeNs());
  SeriesData<CaptureDurationData<CaptureObject>> data2 = dataList.get(1);
  assertEquals(17, data2.x);
  assertEquals(Long.MAX_VALUE, data2.value.getDurationUs());
  CaptureObject capture2 = data2.value.getCaptureEntry().getCaptureObject();
  assertEquals(TimeUnit.MICROSECONDS.toNanos(17), capture2.getStartTimeNs());
  assertEquals(Long.MAX_VALUE, capture2.getEndTimeNs());
}