DateTypeConverters { @Nullable @TypeConverter public static String fromOffsetDateTime(@Nullable OffsetDateTime dateTime) { if (dateTime == null) { return null; } else { return dateTime.format(OFFSET_FORMATTER); } } private  DateTypeConverters(); @Nullable @TypeConverter static OffsetDateTime toOffsetDateTime(@Nullable String sqlValue); @Nullable @TypeConverter static String fromOffsetDateTime(@Nullable OffsetDateTime dateTime); @Nullable @TypeConverter static String fromInstant(Instant instant); @Nullable @TypeConverter static Instant toInstant(String value);  }
@Test public void toOffsetDateTimeNull() { assertNull(DateTypeConverters.fromOffsetDateTime(null)); }
@Test public void fromOffsetDateTime() { OffsetDateTime now = OffsetDateTime.now(); String value = now.format(DateTypeConverters.OFFSET_FORMATTER); assertEquals(now, DateTypeConverters.toOffsetDateTime(value)); }