@Test
public void testAggregateWithWeightedAverageLacksWeightInformation() {

    Map<Long, List<Pair<String, Double>>> keyMetric = new HashMap<>();
    List<Pair<String, Double>> keyPoints1 = new ArrayList<>();
    keyPoints1.add(Pair.of("stream1", 10.0));
    keyPoints1.add(Pair.of("stream2", 20.0));
    keyMetric.put(1L, keyPoints1);
    List<Pair<String, Double>> keyPoints2 = new ArrayList<>();
    keyPoints2.add(Pair.of("stream1", 10.0));
    keyPoints2.add(Pair.of("stream2", 20.0));
    keyMetric.put(2L, keyPoints2);
    List<Pair<String, Double>> keyPoints3 = new ArrayList<>();
    keyPoints3.add(Pair.of("stream1", 10.0));
    keyPoints3.add(Pair.of("stream2", 20.0));
    keyMetric.put(3L, keyPoints3);
    Map<Long, List<Pair<String, Double>>> weightMetric = new HashMap<>();
    // no weight for 1L
    // total weight is zero for 2L
    List<Pair<String, Double>> weightPoints2 = new ArrayList<>();
    weightPoints2.add(Pair.of("stream1", 0.0));
    weightPoints2.add(Pair.of("stream2", 0.0));
    weightMetric.put(2L, weightPoints2);
    // no weight for 3L - stream2
    List<Pair<String, Double>> weightPoints3 = new ArrayList<>();
    weightPoints3.add(Pair.of("stream1", 10.0));
    weightMetric.put(3L, weightPoints3);
    Map<Long, Double> ret = querier.aggregateWithApplyingWeightedAverage(keyMetric, weightMetric);
    Assert.assertEquals(3, ret.size());
    Double aggregated = ret.get(1L);
    Assert.assertNotNull(aggregated);
    Assert.assertEquals(0.0d, aggregated, 0.00001d);
    aggregated = ret.get(2L);
    Assert.assertNotNull(aggregated);
    Assert.assertEquals(0.0d, aggregated, 0.00001d);
    aggregated = ret.get(3L);
    Assert.assertNotNull(aggregated);
    // only weight and value for stream1 is considered
    Assert.assertEquals(10.0d, aggregated, 0.00001d);
}