### Question:
ZonedDateTimeConverter extends TypeConverter implements SimpleValueConverter { @Override public Object decode( final Class<?> targetClass, final Object val, final MappedField optionalExtraInfo) { if (val == null) { return null; } if (val instanceof Date) { return ZonedDateTime.ofInstant(((Date) val).toInstant(), UTC); } if (val instanceof String) { return ZonedDateTime.ofInstant(ZonedDateTime.parse((String) val).toInstant(), UTC); } throw new IllegalArgumentException("Can't convert to ZonedDateTime from " + val); } 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 shouldDecodeNull() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); Object result = converter.decode(ZonedDateTime.class, null, null); assertThat(result).isNull(); }
@Test public void shouldDecodeDate() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris")); cal.clear(); cal.set(2019, Calendar.MARCH, 21, 17, 22, 53); ZonedDateTime result = (ZonedDateTime) converter.decode(ZonedDateTime.class, cal.getTime(), null); assertThat(result).isEqualTo("2019-03-21T17:22:53+01:00[Europe/Paris]"); }
@Test public void shouldDecodeString() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); ZonedDateTime result = (ZonedDateTime) converter.decode(ZonedDateTime.class, "2019-01-21T17:22:53+01:00[Europe/Paris]", null); assertThat(result).isEqualTo("2019-01-21T17:22:53+01:00[Europe/Paris]"); }
@Test(expected = IllegalArgumentException.class) public void shouldFailOnDecodeWrongType() { ZonedDateTimeConverter converter = new ZonedDateTimeConverter(); converter.decode(ZonedDateTime.class, new Object(), null); }