### Question:
ZonedDateTimeUTCtoEuropeConverter extends TypeConverter implements SimpleValueConverter { @Override public Object decode(Class<?> targetClass, Object fromDBObject, MappedField optionalExtraInfo) { if (fromDBObject == null || !(fromDBObject instanceof Date)) { return null; } Date date = (Date) fromDBObject; ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.of("UTC")); if (optionalExtraInfo != null && optionalExtraInfo.getField().isAnnotationPresent(ZonedDateTimeEurope.class)) { zonedDateTime = zonedDateTime.toInstant().atZone(ZoneId.of("Europe/Paris")); } return zonedDateTime; } ZonedDateTimeUTCtoEuropeConverter(); @Override Object encode(Object value, MappedField optionalExtraInfo); @Override Object decode(Class<?> targetClass, Object fromDBObject, MappedField optionalExtraInfo);  }### Answer:
@Test public void testDecodeUTCtoZonedDateEurope() { ZonedDateTime expected = ZonedDateTime.of(2017, 6, 20, 0, 0, 0, 0, ZoneId.of("Europe/Paris")); ZonedDateTimeUTCtoEuropeConverter cut = new ZonedDateTimeUTCtoEuropeConverter(); Field mockedField = mock(Field.class); when(mockedField.isAnnotationPresent(ZonedDateTimeEurope.class)).thenReturn(true); MappedField mockedMappedField = mock(MappedField.class); when(mockedMappedField.getField()).thenReturn(mockedField); Date date = new Date(); date.setTime(1497909600000L); final Object decode = cut.decode(ZonedDateTime.class, date, mockedMappedField); assertThat(decode, instanceOf(ZonedDateTime.class)); assertThat(decode, is(expected)); assertThat(((ZonedDateTime)decode).getZone(), is(ZoneId.of("Europe/Paris"))); }