### Question:
MetricSampleAggregator extends LongGenerationed { public Long earliestWindow() { return _rawMetrics.isEmpty() ? null : _oldestWindowIndex * _windowMs; } MetricSampleAggregator(int numWindows,
                                long windowMs,
                                byte minSamplesPerWindow,
                                int completenessCacheSize,
                                MetricDef metricDef); boolean addSample(MetricSample<G, E> sample); MetricSampleAggregationResult<G, E> aggregate(long from, long to, AggregationOptions<G, E> options); Map<E, ValuesAndExtrapolations> peekCurrentWindow(); MetricSampleCompleteness<G, E> completeness(long from, long to, AggregationOptions<G, E> options); List<Long> availableWindows(); int numAvailableWindows(); int numAvailableWindows(long from, long to); List<Long> allWindows(); Long earliestWindow(); int numSamples(); void retainEntities(Set<E> entities); void removeEntities(Set<E> entities); void retainEntityGroup(Set<G> entityGroups); void removeEntityGroup(Set<G> entityGroups); void clear(); long monitoringPeriodMs();  }### Answer:
@Test public void testEarliestWindow() { MetricSampleAggregator<String, IntegerEntity> aggregator = new MetricSampleAggregator<>(NUM_WINDOWS, WINDOW_MS, MIN_SAMPLES_PER_WINDOW, 0, _metricDef); assertNull(aggregator.earliestWindow()); CruiseControlUnitTestUtils.populateSampleAggregator(NUM_WINDOWS, MIN_SAMPLES_PER_WINDOW, aggregator, ENTITY1, 0, WINDOW_MS, _metricDef); assertEquals(WINDOW_MS, aggregator.earliestWindow().longValue()); CruiseControlUnitTestUtils.populateSampleAggregator(2, MIN_SAMPLES_PER_WINDOW, aggregator, ENTITY1, NUM_WINDOWS, WINDOW_MS, _metricDef); assertEquals(2 * WINDOW_MS, aggregator.earliestWindow().longValue()); }