@Test
public void testDataIncludeMultipleSamples() {

  MemoryData memoryData = MemoryData.newBuilder()
    .setEndTimestamp(TimeUnit.MICROSECONDS.toNanos(555))
    .addMemSamples(0, MemoryData.MemorySample.newBuilder()
      .setTimestamp(TimeUnit.MICROSECONDS.toNanos(333))
      .setMemoryUsage(Memory.MemoryUsageData.newBuilder()
        .setJavaMem(333).setTotalMem(333)))
    .addMemSamples(1, MemoryData.MemorySample.newBuilder()
      .setTimestamp(TimeUnit.MICROSECONDS.toNanos(444))
      .setMemoryUsage(Memory.MemoryUsageData.newBuilder()
        .setNativeMem(444).setTotalMem(444)))
    .build();
  myService.setMemoryData(memoryData);
  MemoryDataSeries series =
    new MemoryDataSeries(new ProfilerClient(myGrpcChannel.getName()).getMemoryClient(), ProfilersTestData.SESSION_DATA, data -> 111L);
  List<SeriesData<Long>> seriesDataList = series.getDataForRange(new Range(0, Double.MAX_VALUE));
  assertEquals(2, seriesDataList.size());
  assertEquals(333, seriesDataList.get(0).x);
  assertEquals(111, seriesDataList.get(0).value.longValue());
  assertEquals(444, seriesDataList.get(1).x);
  assertEquals(111, seriesDataList.get(1).value.longValue());
}