@Test
public void testJoinTransformWithMultipleMetrics() {

    Transform joinTransform = new JoinTransform();
    Map<Long, Double> datapoints_1 = new HashMap<Long, Double>();
    datapoints_1.put(1000L, 1.0);
    datapoints_1.put(2000L, 2.0);
    datapoints_1.put(3000L, 3.0);
    Metric metric_1 = new Metric(TEST_SCOPE, TEST_METRIC);
    metric_1.setDatapoints(datapoints_1);
    Map<Long, Double> datapoints_2 = new HashMap<Long, Double>();
    datapoints_2.put(4000L, 10.0);
    datapoints_2.put(5000L, 100.0);
    datapoints_2.put(6000L, 1000.0);
    Metric metric_2 = new Metric(TEST_SCOPE, TEST_METRIC);
    metric_2.setDatapoints(datapoints_2);
    Map<Long, Double> datapoints_3 = new HashMap<Long, Double>();
    datapoints_3.put(7000L, 0.1);
    datapoints_3.put(8000L, 0.01);
    datapoints_3.put(9000L, 0.0001);
    Metric metric_3 = new Metric(TEST_SCOPE, TEST_METRIC);
    metric_3.setDatapoints(datapoints_3);
    final List<Metric> metrics_1 = new ArrayList<Metric>();
    final List<Metric> metrics_2 = new ArrayList<Metric>();
    final List<Metric> metrics_3 = new ArrayList<Metric>();
    metrics_1.add(metric_1);
    metrics_2.add(metric_2);
    metrics_3.add(metric_3);
    Map<Long, Double> expected_1 = new HashMap<Long, Double>();
    Map<Long, Double> expected_2 = new HashMap<Long, Double>();
    Map<Long, Double> expected_3 = new HashMap<Long, Double>();
    expected_1.put(1000L, 1.0);
    expected_1.put(2000L, 2.0);
    expected_1.put(3000L, 3.0);
    expected_2.put(4000L, 10.0);
    expected_2.put(5000L, 100.0);
    expected_2.put(6000L, 1000.0);
    expected_3.put(7000L, 0.1);
    expected_3.put(8000L, 0.01);
    expected_3.put(9000L, 0.0001);
    List<Metric> result = joinTransform.transform(null, metrics_1, metrics_2, metrics_3);
    assertEquals(result.size(), 3);
    assertEquals(expected_1, result.get(0).getDatapoints());
    assertEquals(expected_2, result.get(1).getDatapoints());
    assertEquals(expected_3, result.get(2).getDatapoints());
}