AvgLabeledFunction extends Metrics implements AcceptableValue<DataTable>, LabeledValueHolder { @Override public RemoteData.Builder serialize() { RemoteData.Builder remoteBuilder = RemoteData.newBuilder(); remoteBuilder.addDataObjectStrings(count.toStorageData()); remoteBuilder.addDataObjectStrings(summation.toStorageData()); remoteBuilder.addDataLongs(getTimeBucket()); remoteBuilder.addDataStrings(entityId); remoteBuilder.addDataStrings(serviceId); return remoteBuilder; }  @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 testSerialize() { function.accept(MeterEntity.newService("request_count"), build(asList("200", "404"), asList(10L, 2L))); AvgLabeledFunction function2 = Mockito.spy(AvgLabeledFunction.class); function2.deserialize(function.serialize().build()); assertThat(function2.getEntityId(), is(function.getEntityId())); assertThat(function2.getTimeBucket(), is(function.getTimeBucket())); }