@Test
public void transform_shouldReturnIntegralForTwoMetrics() {

    Transform integralTransform = new MetricMappingTransform(new IntegralValueMapping());
    Metric m1 = new Metric("test_scope", "test_metric");
    HashMap<Long, Double> dp1 = new HashMap<Long, Double>();
    dp1.put(2L, 4.0);
    dp1.put(3L, 6.0);
    m1.setDatapoints(dp1);
    Metric m2 = new Metric("test_scope", "test_metric");
    HashMap<Long, Double> dp2 = new HashMap<Long, Double>();
    dp2.put(3L, 5.0);
    dp2.put(9L, 2.0);
    dp2.put(2L, 6.0);
    m2.setDatapoints(dp2);
    List<Metric> metrics = Arrays.asList(m1, m2);
    List<Metric> results = integralTransform.transform(null, metrics);
    assertThat(results, equalTo(metrics));
    Map<Long, Double> expectedDps1 = new HashMap<Long, Double>();
    expectedDps1.put(2L, 4.0);
    expectedDps1.put(3L, 10.0);
    assertThat(results.get(0).getDatapoints(), equalTo(expectedDps1));
    Map<Long, Double> expectedDps2 = new HashMap<Long, Double>();
    expectedDps2.put(2L, 6.0);
    expectedDps2.put(3L, 11.0);
    expectedDps2.put(9L, 13.0);
    assertThat(results.get(1).getDatapoints(), equalTo(expectedDps2));
}