public void add(short metricId, MetricValues metricValuesToAdd) {
    validateNotNull(metricValuesToAdd, "The metric values to be added cannot be null");
    if (!_metricValues.isEmpty() && metricValuesToAdd.length() != length()) {
      throw new IllegalArgumentException("The existing metric length is " + length() + " which is different from the"
                                             + " metric length of " + metricValuesToAdd.length() + " that is being added.");
    }
    MetricValues metricValues = _metricValues.computeIfAbsent(metricId, id -> new MetricValues(metricValuesToAdd.length()));
    metricValues.add(metricValuesToAdd);
  }
@Test
  public void testAdd() {
    Map<Short, MetricValues> valuesByMetricId = getValuesByMetricId();

    AggregatedMetricValues aggregatedMetricValues = new AggregatedMetricValues(valuesByMetricId);
    aggregatedMetricValues.add(aggregatedMetricValues);

    for (Map.Entry<Short, MetricValues> entry : valuesByMetricId.entrySet()) {
      MetricValues values = entry.getValue();
      for (int j = 0; j < 10; j++) {
        assertEquals(2 * j, values.get(j), 0.01);
      }
    }
  }