ZonedDateTimeToLocalDateTimeConverter implements Converter<LocalDateTime, ZonedDateTime> { @Override public Result<ZonedDateTime> convertToModel(LocalDateTime value, ValueContext context) { if (value == null) { return Result.ok(null); } return Result.ok(value.atZone(zoneId)); } ZonedDateTimeToLocalDateTimeConverter(ZoneId zoneId); @Override Result<ZonedDateTime> convertToModel(LocalDateTime value, ValueContext context); @Override LocalDateTime convertToPresentation(ZonedDateTime value, ValueContext context);  }
@Test public void testConvertToModel() { assertNull(converter.convertToModel(null, createContext()).getOrThrow(r -> new OCSRuntimeException())); LocalDateTime ldt = LocalDateTime.of(2018, 4, 4, 3, 3); Result<ZonedDateTime> zdt = converter.convertToModel(ldt, createContext()); ZonedDateTime t = zdt.getOrThrow(r -> new OCSRuntimeException()); assertEquals(ldt, t.toLocalDateTime()); }