@Test
public void testGetDataForXRange() throws Exception {

  MemoryData memoryData = MemoryData.newBuilder()
    .setEndTimestamp(1)
    .addGcStatsSamples(
      MemoryData.GcStatsSample.newBuilder().setStartTime(TimeUnit.MICROSECONDS.toNanos(3))
        .setEndTime(TimeUnit.MICROSECONDS.toNanos(7)))
    .addGcStatsSamples(
      MemoryData.GcStatsSample.newBuilder().setStartTime(TimeUnit.MICROSECONDS.toNanos(14))
        .setEndTime(TimeUnit.MICROSECONDS.toNanos(17)))
    .build();
  myService.setMemoryData(memoryData);
  LegacyGcStatsDataSeries
    series = new LegacyGcStatsDataSeries(new ProfilerClient(myGrpcChannel.getName()).getMemoryClient(), ProfilersTestData.SESSION_DATA);
  List<SeriesData<GcDurationData>> dataList = series.getDataForRange(new Range(0, Double.MAX_VALUE));
  assertEquals(2, dataList.size());
  SeriesData<GcDurationData> data1 = dataList.get(0);
  assertEquals(3, data1.x);
  assertEquals(4, data1.value.getDurationUs());
  SeriesData<GcDurationData> data2 = dataList.get(1);
  assertEquals(14, data2.x);
  assertEquals(3, data2.value.getDurationUs());
}