TimeAgnosticStatisticEvent implements Serializable { public static TimeAgnosticStatisticEvent createCount(final String name, final List<StatisticTag> tagList, final Long count) { if (count == null) { throw new IllegalArgumentException("Statistic must have a count"); } return new TimeAgnosticStatisticEvent(name, tagList, count, null, StatisticType.COUNT); } private  TimeAgnosticStatisticEvent(final String name,
                                       final List<StatisticTag> tagList,
                                       final Long count,
                                       final Double value,
                                       final StatisticType statisticType); static TimeAgnosticStatisticEvent createCount(final String name,
                                                         final List<StatisticTag> tagList,
                                                         final Long count); static TimeAgnosticStatisticEvent createValue(final String name,
                                                         final List<StatisticTag> tagList,
                                                         final Double value); List<StatisticTag> getTagList(); StatisticType getType(); String getName(); double getValue(); long getCount(); StatisticType getStatisticType(); Integer getTagPosition(final String tagName); String getTagValue(final String tagName); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test void serialiseTest() { final List<StatisticTag> tagList = new ArrayList<>(); tagList.add(new StatisticTag("tag1", "val1")); tagList.add(new StatisticTag("tag2", "val2")); final TimeAgnosticStatisticEvent timeAgnosticStatisticEvent = TimeAgnosticStatisticEvent.createCount("MtStatName", tagList, 42L); final byte[] serializedForm = SerializationUtils.serialize(timeAgnosticStatisticEvent); final TimeAgnosticStatisticEvent timeAgnosticStatisticEvent2 = (TimeAgnosticStatisticEvent) SerializationUtils .deserialize(serializedForm); assertThat(timeAgnosticStatisticEvent2).isEqualTo(timeAgnosticStatisticEvent); }