AvgLabeledFunction extends Metrics implements AcceptableValue<DataTable>, LabeledValueHolder { @Override public Class<? extends AvgLabeledStorageBuilder> builder() { return AvgLabeledStorageBuilder.class; }  @Override final void combine(Metrics metrics); @Override final void calculate(); @Override Metrics toHour(); @Override Metrics toDay(); @Override int remoteHashCode(); @Override void deserialize(final RemoteData remoteData); @Override RemoteData.Builder serialize(); @Override String id(); @Override void accept(final MeterEntity entity, final DataTable value); @Override Class<? extends AvgLabeledStorageBuilder> builder(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testBuilder() throws IllegalAccessException, InstantiationException { function.accept(MeterEntity.newService("request_count"), build(asList("200", "404"), asList(10L, 2L))); function.calculate(); StorageBuilder<AvgLabeledFunction> storageBuilder = function.builder().newInstance(); Map<String, Object> map = storageBuilder.data2Map(function); map.put(SUMMATION, ((DataTable) map.get(SUMMATION)).toStorageData()); map.put(COUNT, ((DataTable) map.get(COUNT)).toStorageData()); map.put(VALUE, ((DataTable) map.get(VALUE)).toStorageData()); AvgLabeledFunction function2 = storageBuilder.map2Data(map); assertThat(function2.getValue(), is(function.getValue())); }