DateDateMidnightConverter implements TypeConverter<Date, DateMidnight> { @Override public DateMidnight convert(Date object, SyntheticField domainField, Object domainObject, String... tags) throws JTransfoException { if (null == object) { return null; } return new DateMidnight(object.getTime()); }  @Override boolean canConvert(Type realToType, Type realDomainType); @Override DateMidnight convert(Date object, SyntheticField domainField, Object domainObject, String... tags); @Override Date reverse(DateMidnight object, SyntheticField toField, Object toObject, String... tags);  }
@Test public void testConvert() throws Exception { assertThat(typeConverter.convert(null, null, null)).isNull(); assertThat(typeConverter.convert(dm1.toDate(), null, null)).isEqualTo(dm1); assertThat(typeConverter.convert(dm2.toDate(), null, null)).isEqualTo(dm2); assertThat(typeConverter.convert(dm3.toDate(), null, null)).isEqualTo(dm3); assertThat(typeConverter.convert(dm3t.toDate(), null, null)).isEqualTo(dm3); }