Aggregator { public static <T> AggregationResult<T> aggregate(final List<Measurement<T>> measurements) { long start = -1; long duration = 0; if (measurements.size() > 0) { start = measurements.get(0).getTimestamp(); duration = measurements.get(measurements.size() - 1).getTimestamp() - start; } final AggregationResult<T> aggregationResult = new AggregationResult<>(start, duration); aggregate(measurements, aggregationResult); return aggregationResult; } Aggregator();  Aggregator(final int aggregationTime, final TimeUnit timeUnit); boolean submit(final Measurement<T> measurement); List<AggregationResult<T>> process(); List<AggregationResult<T>> process(final long currentTimeNanos); static AggregationResult<T> aggregate(final List<Measurement<T>> measurements);  }
@Test public void aggregate() { final ArrayList<Measurement<UUID>> list = new ArrayList<>(); for (int rssiValue : RSSI_VALUES) { list.add(new Measurement<>(SENDER_ID, System.nanoTime(), rssiValue, rssiValue + 30, rssiValue + 90)); } final AggregationResult<UUID> result = Aggregator.aggregate(list); checkResults(result); }