### Question:
LocalDateConverter extends TypeConverter implements SimpleValueConverter { @Override public Object encode( Object value, @SuppressWarnings("deprecation") MappedField optionalExtraInfo) { if (value == null) { return null; } if (value instanceof LocalDate) { return ((LocalDate) value).format(ISO_LOCAL_DATE); } throw new IllegalArgumentException( String.format("Cannot encode object of class: %s", value.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 shouldEncodeAsIsoLocalDateString() { LocalDate given = LocalDate.parse("2020-03-15"); Object actual = localDateConverter.encode(given, null); assertThat(actual).isInstanceOf(String.class).isEqualTo("2020-03-15"); }
@Test public void shouldEncodeNullAsNull() { LocalDate given = null; Object actual = localDateConverter.encode(given, null); assertThat(actual).isNull(); }
@Test public void allowEncodeFailureForBadDataType() { ZonedDateTime given = ZonedDateTime.now(); assertThatIllegalArgumentException().isThrownBy(() -> localDateConverter.encode(given, null)); }