### Question:
DataAggregator extends DateRangedObject { public void aggregate() { Date[] dateRange = dateRangeHelper.getDateRange(getAggregationDiff()); for (int i = 0; i < dateRange.length - 1; i++) { for (Entry<String, AggregationData<String>> oldMetricTimeSeriesEntry : oldMetricTimeSeriesData.entrySet()) { Set<AggregationData<String>> oldMetricValuesInRange = new HashSet(); AggregationData<String> oldMetricTimeSeriesRow = oldMetricTimeSeriesEntry.getValue(); String oldMetricTimeSeriesRowKey = oldMetricTimeSeriesRow.getKey(); Map oldTimeSeriesColumns = oldMetricTimeSeriesRow.getColumns(); for (Object timeStampObj : oldTimeSeriesColumns.keySet()) { Long oldTimeSeriesTsmp = (Long) timeStampObj; if (oldTimeSeriesTsmp >= dateRange[i].getTime() && oldTimeSeriesTsmp < dateRange[i + 1].getTime()) { Set<String> oldMetricValuesKeys = (Set<String>) oldTimeSeriesColumns.get(timeStampObj); oldMetricValuesInRange.addAll(getAllMetricValues(oldMetricValuesKeys)); } } if (!oldMetricValuesInRange.isEmpty()) { String newMetricValueKey = createMetricValueKey(oldMetricTimeSeriesRowKey, dateRange[i]); String newMetricTimeSeriesKey = createMetricTimeSeriesKey(oldMetricTimeSeriesRowKey); AggregationData<String> newMetricValue = addAllMetricValuesInrange(oldMetricValuesInRange, newMetricValueKey); addNewMetricTimeSeriesColumn(newMetricTimeSeriesKey, dateRange[i].getTime(), newMetricValueKey); aggregatedMetricValuesData.put(newMetricValueKey, newMetricValue); } } } } DataAggregator(Date startTime, Date endTime, Map<String, AggregationData<String>> metricTimeSeriesData,
            Map<String, AggregationData<String>> metricValuesData, int oldAggregationPeriodInSecs,
            int newAggregationPeriodInSecs); void aggregate(); int getAggregationDiff(); String createMetricTimeSeriesKey(String oldMetricTimeSeriesRowKey); String createMetricValueKey(String oldMetricTimeSeriesKey, Date date); Map<String, AggregationData<String>> getAggregatedMetricTimeSeriesData(); Map<String, AggregationData<String>> getAggregatedMetricValuesData(); Object aggregateColumnValues(Object aggregatedValue, Object oldColumnValue); Set<AggregationData<String>> getAllMetricValues(Set<String> oldMetricValuesKeys);  }### Answer:
@Test public void testAggregate() { aggregator.aggregate(); Map<String, AggregationData<String>> aggregatedMetricTimeSeriesData = aggregator .getAggregatedMetricTimeSeriesData(); assertNotNull(aggregatedMetricTimeSeriesData); Map<String, AggregationData<String>> aggregatedMetricValuesData = aggregator.getAggregatedMetricValuesData(); assertNotNull(aggregatedMetricValuesData); }