LocalDateConverter implements AttributeConverter<LocalDate, Date> { @Override public LocalDate convertToEntityAttribute(Date date) { LOGGER.finest(() -> "Converting " + date + " to attrib"); if (null == date) { return null; } return date.toLocalDate(); }  @Override Date convertToDatabaseColumn(LocalDate localDate); @Override LocalDate convertToEntityAttribute(Date date);  }
@Test public void null_values_are_read_as_nulls() { assertNull(new LocalDateConverter().convertToEntityAttribute(null)); }
@Test public void simple_dates_are_read_as_proper_localdates_without_timedata() { Date date = Date.valueOf("2012-02-12"); LocalDate localDate = new LocalDateConverter().convertToEntityAttribute(date); assertThat(localDate, is(equalTo(LocalDate.of(2012, FEBRUARY, 12)))); }