TypeConversionImpl implements TypeConversion { @Override public String convert(@Nullable final Object value) { if (value == null) { return null; } if (TYPE_CONVERTER_BY_CLASSNAME.containsKey(value.getClass())) { final TypeConverter typeConverter = TYPE_CONVERTER_BY_CLASSNAME.get(value.getClass()); return typeConverter.convert(value); } return value.toString(); }  @Override String convert(@Nullable final Object value);  }
@Test public void dateConverter_should_beRegistered() { final Date value = new Date(1234); assertThat(conversion.convert(value), is(DateFormatter.print(value))); }
@Test public void localDateConverter_should_beRegistered() { final LocalDate value = new LocalDate(1234L); assertThat(conversion.convert(value), is(DateFormatter.print(value))); }
@Test public void dateTimeConverter_should_beRegistered() { final DateTime value = new DateTime(1234); assertThat(conversion.convert(value), is(DateFormatter.print(value))); }
@Test public void aNonRegisteredConversion_should_returnToString() { assertThat(conversion.convert(new Object() { @Override public String toString() { return "hallo"; } }), is("hallo")); }