OrderedDateSerialiser implements ToBytesSerialiser<Date> { @Override public byte[] serialise(final Date object) { return LONG_SERIALISER.serialise(object.getTime()); }  @Override byte[] serialise(final Date object); @Override Date deserialise(final byte[] bytes); @Override Date deserialiseEmpty(); @Override boolean preservesObjectOrdering(); @Override boolean isConsistent(); @Override boolean canHandle(final Class clazz); @Override boolean equals(final Object obj); @Override int hashCode();  }
@Test public void checkOrderPreserved() throws SerialisationException { Date testDate = new Date(1L); Date aDayLater = new Date(86400000L); assertTrue(compare(serialiser.serialise(testDate), serialiser.serialise(aDayLater)) < 0); }
@Test public void checkMultipleDatesOrderPreserved() throws SerialisationException { Date startTestDate = new Date(1L); Date newTestDate; for (Long time = 2L; time > 10L; time++) { newTestDate = new Date(time); assertTrue(compare(serialiser.serialise(startTestDate), serialiser.serialise(newTestDate)) < 0); startTestDate = newTestDate; } }