@Test
public void testFillingDatapointsAtEdges() {

    Transform fillTransform = new FillTransform();
    Map<Long, Double> datapoints = new HashMap<Long, Double>();
    datapoints.put(4000L, 4.0);
    datapoints.put(5000L, 5.0);
    datapoints.put(6000L, 6.0);
    Metric metric = new Metric(TEST_SCOPE, TEST_METRIC);
    metric.setDatapoints(datapoints);
    List<Metric> metrics = new ArrayList<Metric>();
    metrics.add(metric);
    List<String> constants = new ArrayList<String>();
    constants.add("1s");
    constants.add("0m");
    constants.add("100.0");
    constants.add(System.currentTimeMillis() + "");
    constants.add("false");
    
    QueryContext context = QueryUtils.getQueryContext("1000:8000:argus.core:alerts.evaluated:zimsum:1m-sum", 0L);
    Map<Long, Double> expected = new TreeMap<Long, Double>();
    expected.put(1000L, 100.0);
    expected.put(2000L, 100.0);
    expected.put(3000L, 100.0);
    expected.put(4000L, 4.0);
    expected.put(5000L, 5.0);
    expected.put(6000L, 6.0);
    expected.put(7000L, 100.0);
    expected.put(8000L, 100.0);
    
    List<Metric> result = fillTransform.transform(context, metrics, constants);
    assertEquals(result.get(0).getDatapoints().size(), 8);
    assertEquals(expected, result.get(0).getDatapoints());
}