### Question:
AggregatedMetricValues { public void add(short metricId, MetricValues metricValuesToAdd) { if (metricValuesToAdd == null) { throw new IllegalArgumentException("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); } AggregatedMetricValues();  AggregatedMetricValues(Map<Short, MetricValues> valuesByMetricId); MetricValues valuesFor(short metricId); AggregatedMetricValues valuesFor(Collection<Short> metricIds, boolean shareValueArray); MetricValues valuesForGroup(String group, MetricDef metricDef, boolean shareValueArray); int length(); boolean isEmpty(); Set<Short> metricIds(); void add(short metricId, MetricValues metricValuesToAdd); void add(AggregatedMetricValues other); void subtract(AggregatedMetricValues other); void clear(); void writeTo(OutputStream out); @Override String toString();  }### Answer:
@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); } } }