InstantSerde implements Serde<String, Instant> { @Override public String serialize(final Instant value) { return DateTimeFormatter.ISO_INSTANT.format(value); }  @Override Instant deserialize(final String value); @Override String serialize(final Instant value);  }
@Test public void canSerialize() { assertEquals( "2019-06-01T09:42:55Z", serde.serialize(Instant.ofEpochSecond(1559382175)) ); }
@Test public void canSerializeSubSecondPrecision() { assertEquals( "2019-06-01T09:42:55.123Z", serde.serialize(Instant.ofEpochMilli(1559382175123L)) ); }