### Question:
DoubleMaxAggregatorFunction implements Function<List<Double>, Double> { public Double evaluate(List<Double> data) { if (data == null || data.size() == 0) { return null; } Double max = null; for (Double d : data) { if (max == null) { max = d; } else { if (max.doubleValue() < d.doubleValue()) { max = d; } } } return max; }  Double evaluate(List<Double> data); @Override String toString();  }### Answer:
@Test public void testEmptyList() throws Exception { DoubleMaxAggregatorFunction fct = (DoubleMaxAggregatorFunction) makeFunctor(); List<Double> lst = null; Double res = fct.evaluate(lst); assertNull(res); lst = new ArrayList<Double>(); res = fct.evaluate(lst); assertNull(res); }
@Test public void testSum() throws Exception { DoubleMaxAggregatorFunction fct = (DoubleMaxAggregatorFunction) makeFunctor(); List<Double> lst = new ArrayList<Double>(); lst.add(0.0); double res = fct.evaluate(lst); assertEquals(res, 0.0, 0.01); lst.add(1.0); res = fct.evaluate(lst); assertEquals(res, 1.0, 0.01); lst.add(2.0); res = fct.evaluate(lst); assertEquals(res, 2.0, 0.01); lst.clear(); int calls = 31; double max = 0.0; Random rnd = new Random(); for (int i = 0; i < calls; i++) { double random = rnd.nextDouble(); lst.add(random); if (random > max) { max = random; } res = fct.evaluate(lst); assertEquals(res, max, 0.01); } }