@Test
public void testCalculateWeightedAverageLacksWeightInformation() {

    Map<Long, Double> keyMetrics = new HashMap<>();
    keyMetrics.put(1L, 10.0);
    keyMetrics.put(2L, 20.0);
    // no weight for both 1L and 2L
    double actual = ComponentMetricSummary.calculateWeightedAverage(keyMetrics, Collections.emptyMap());
    Assert.assertEquals(0.0, actual, DoubleUtils.EPSILON);
    Map<Long, Double> weightMetrics = new HashMap<>();
    // no weight for 1L
    weightMetrics.put(2L, 5.0);
    actual = ComponentMetricSummary.calculateWeightedAverage(keyMetrics, weightMetrics);
    // only weight and value for 2L is considered
    Assert.assertEquals(20.0, actual, DoubleUtils.EPSILON);
}