EvalMultipleData extends EvalData<EvalMultipleData> { EvalData combineAsSingleData() { return dataList.stream().reduce(EvalData::combine).orElseThrow(IllegalArgumentException::new); } EvalMultipleData(String meterName);  EvalMultipleData(String meterName, List<EvalData> dataList); EvalMultipleData tagFilter(String key, String value); @Override EvalMultipleData multiply(double value); @Override EvalMultipleData multiply(EvalMultipleData value); @Override EvalMultipleData add(double value); @Override EvalMultipleData add(EvalMultipleData value); @Override EvalMultipleData scale(Integer value); @Override EvalMultipleData minus(double value); @Override EvalMultipleData minus(EvalMultipleData value); @Override EvalMultipleData divide(double value); @Override EvalMultipleData divide(EvalMultipleData value); @Override EvalMultipleData irate(String range); @Override EvalMultipleData rate(String range); @Override EvalMultipleData increase(String range);  }
@Test public void testCombineAsSingleValue() { final EvalSingleData combinedSingleData = (EvalSingleData) singleMultiple.combineAsSingleData(); Assert.assertEquals(60d, combinedSingleData.getValue(), 0.0); final EvalHistogramData combinedHistogramData = (EvalHistogramData) histogramMultiple.combineAsSingleData(); Assert.assertEquals(30, combinedHistogramData.getBuckets().get(1d).longValue()); Assert.assertEquals(50, combinedHistogramData.getBuckets().get(5d).longValue()); Assert.assertEquals(35, combinedHistogramData.getBuckets().get(10d).longValue()); }