### Question:
DateTimeAttribute implements ExchangeAttribute { @Override public String readAttribute(final RoutingContext exchange) { return formatter.format(ZonedDateTime.now()); } private  DateTimeAttribute();  DateTimeAttribute(final String dateFormat);  DateTimeAttribute(final String dateFormat, final String timezone); @Override String readAttribute(final RoutingContext exchange); @Override void writeAttribute(final RoutingContext exchange, final String newValue); static final String DATE_TIME_SHORT; static final String DATE_TIME; static final String CUSTOM_TIME; static final ExchangeAttribute INSTANCE; }### Answer:
@Test void shouldReadAttribute() { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); DateTimeAttribute dta = new DateTimeAttribute("dd/MM/yyyy"); assertThat(dta.readAttribute(null)).isEqualTo(sdf.format(new Date())); }
@Test void testDefaultDateFormat() { final ExchangeAttribute attribute = new DateTimeAttribute.Builder().build(DateTimeAttribute.DATE_TIME_SHORT); final String value = attribute.readAttribute(null); Assertions.assertNotNull(value, DateTimeAttribute.DATE_TIME_SHORT + " attribute returned null"); Assertions.assertFalse(value.trim().isEmpty(), DateTimeAttribute.DATE_TIME_SHORT + " attribute returned empty value"); }