### Question:
ZonedDateTimeConverter extends TypeConverter implements SimpleValueConverter { @Override public Object encode(final Object value, final MappedField optionalExtraInfo) { if (value == null) { return null; } if (value instanceof ZonedDateTime) { return Date.from(((ZonedDateTime) value).toInstant()); } throw new IllegalArgumentException("Can't convert to ZonedDateTime from " + value); } ZonedDateTimeConverter(); protected  ZonedDateTimeConverter(final Class<ZonedDateTime> clazz); @Override Object decode(
      final Class<?> targetClass, final Object val, final MappedField optionalExtraInfo); @Override Object encode(final Object value, final MappedField optionalExtraInfo);  }### Answer:
@Test public void shouldEncodeNull() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); Object result = converter.encode(null, null); assertThat(result).isNull(); }
@Test public void shouldEncodeZonedDateTime() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); Date result = (Date) converter.encode(ZonedDateTime.parse("2019-02-21T17:22:53+01:00[Europe/Paris]"), null); assertThat(result).isEqualTo("2019-02-21T17:22:53.000"); }
@Test(expected = IllegalArgumentException.class) public void shouldFailOnEncodeWrongType() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); converter.encode(new Object(), null); }