Aggregations implements Serializable { public static <T extends Number> Aggregation<T> avg(){ return new Avg<>(); } private  Aggregations(); static Aggregation<T> max(); static Aggregation<T> min(); static Aggregation<T> sum(); static Aggregation<T> avg();  }
@Test public void average() { Aggregation<Double> avg = Aggregations.avg(); avg.aggregate(null); avg.aggregate(1D); avg.aggregate(2D); avg.aggregate(3D); avg.aggregate(4D); double aggregated = avg.getAggregated(); Assert.assertEquals(2.5D, aggregated, DELTA); Assert.assertEquals("avg", avg.getIdentifier()); avg.reset(); }
@Test public void averageClone() { Aggregation<Double> avg = ClonerUtil.clone(Aggregations.avg()); avg.aggregate(null); avg.aggregate(1D); avg.aggregate(2D); avg.aggregate(3D); avg.aggregate(4D); double aggregated = avg.getAggregated(); Assert.assertEquals(2.5D, aggregated, DELTA); Assert.assertEquals("avg", avg.getIdentifier()); avg.reset(); }