LongTimeSeries implements TimeSeries<Long> { @Override public String toString() { return new ToStringBuilder(this) .append("timeBucket", timeBucket) .append("timeSeries", timeSeries) .build(); } LongTimeSeries(final TimeBucket timeBucket); @JsonCreator  LongTimeSeries(@JsonProperty("timeBucket") final TimeBucket timeBucket,
                          @JsonProperty("timeSeries") final Map<Instant, Long> timeSeries); @Override void put(final Instant instant, final Long value); @JsonIgnore @Override Long get(final Instant instant); void upsert(final Instant instant, final long count); @JsonIgnore SortedSet<Instant> getInstants(); @JsonIgnore int getNumberOfInstants(); SortedMap<Instant, Long> getTimeSeries(); void setTimeSeries(final Map<Instant, Long> timeSeries); TimeBucket getTimeBucket(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test @Override public void shouldJsonSerialiseAndDeserialise() { final LongTimeSeries obj = getTestObject(); final byte[] json = toJson(obj); final LongTimeSeries deserialisedObj = fromJson(json); JsonAssert.assertEquals(String.format("{%n" + " \"timeBucket\" : \"SECOND\",%n" + " \"timeSeries\" : {%n" + " \"1970-01-01T00:00:01Z\" : 10,%n" + " \"1970-01-01T00:01:40Z\" : 1000%n" + " }%n" + "}"), StringUtil.toString(json)); assertNotNull(deserialisedObj); assertEquals(obj, deserialisedObj); }