  @Test
  public void downsample() {

    FetchChartDataHandler handler = new FetchChartDataHandler();

    List<DataPoint> points = Lists.newArrayList();
    for (int i = 0; i < 10; i++) {
      points.add(new DataPoint(i, i * 10));
    }

    List<DataPoint> downsampledPoints = handler.downsample(3, new Aggregators.AvgAggregator(), points);
    assertEquals(downsampledPoints, Lists.newArrayList(
        new DataPoint(0, 0), new DataPoint(2, 20), new DataPoint(5, 50), new DataPoint(8, 80)));
  }