DateTypeConverters { @Nullable @TypeConverter public static Instant toInstant(String value) { if (value == null) { return null; } else { return Instant.parse(value); } } 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 toInstant() { Instant now = Instant.now(); assertEquals(now, DateTypeConverters.toInstant(now.toString())); }
@Test public void toInstantNull() { assertNull(DateTypeConverters.toInstant(null)); }