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