OffsetDateTimeSerdes implements JsonDeserializer<OffsetDateTime>, JsonSerializer<OffsetDateTime> { OffsetDateTime toOffsetDateTime(String raw) { return toDateObject(raw, OffsetDateTime::from); }  @Override JsonElement serialize(OffsetDateTime src, Type typeOfSrc,
      JsonSerializationContext context); @Override OffsetDateTime deserialize(JsonElement json, Type typeOfT,
      JsonDeserializationContext context);  }
@Test public void testSerdes() { OffsetDateTimeSerdes serdes = new OffsetDateTimeSerdes(); try { serdes.toOffsetDateTime("2002-10-02T10:00:00-05:00"); serdes.toOffsetDateTime("2002-10-02T15:00:00Z"); serdes.toOffsetDateTime("2002-10-02T15:00:00.05Z"); serdes.toOffsetDateTime("1937-01-01T12:00:27.87+00:20"); serdes.toOffsetDateTime("1996-12-19T16:39:57-08:00"); } catch (Exception e) { e.printStackTrace(); fail(); } try { serdes.toOffsetDateTime("2016-12-31T23:59:60Z"); } catch (Exception ignored) { fail(); } }