### Question:
LocalDateConverter extends TypeConverter implements SimpleValueConverter { @Override public Object decode( Class<?> targetClass, Object fromDBObject, @SuppressWarnings("deprecation") MappedField optionalExtraInfo) { if (fromDBObject == null) { return null; } if (fromDBObject instanceof String) { return LocalDate.parse((String) fromDBObject, ISO_LOCAL_DATE_WITH_OPTIONAL_TIME); } throw new IllegalArgumentException( String.format("Cannot decode object of class: %s", fromDBObject.getClass().getName())); } LocalDateConverter(); @Override Object decode(
      Class<?> targetClass,
      Object fromDBObject,
      @SuppressWarnings("deprecation")
          MappedField optionalExtraInfo); @Override Object encode(
      Object value,
      @SuppressWarnings("deprecation")
          MappedField optionalExtraInfo);  }### Answer:
@Test public void shouldDecodeIsoLocalDateString() { String given = "2020-03-15"; Object actual = localDateConverter.decode(LocalDate.class, given, null); assertThat(actual).isInstanceOf(LocalDate.class).isEqualTo(LocalDate.parse("2020-03-15")); }
@Test public void shouldDecodeIsoLocalDateTimeStringForBackwardCompatibility() { String given = "1979-02-08T00:00:00.000"; Object actual = localDateConverter.decode(LocalDate.class, given, null); assertThat(actual).isInstanceOf(LocalDate.class).isEqualTo(LocalDate.parse("1979-02-08")); }
@Test public void shouldDecodeNullAsNull() { String given = null; Object actual = localDateConverter.decode(LocalDate.class, given, null); assertThat(actual).isNull(); }
@Test public void allowDecodeFailureForBadDataType() { long given = Instant.now().toEpochMilli(); assertThatIllegalArgumentException() .isThrownBy(() -> localDateConverter.decode(LocalDate.class, given, null)); }