UtilDateFormatter implements ValueFormatter<Date> { @Override public String format(Date value) { return new SimpleDateFormat(pattern).format(value); } UtilDateFormatter();  UtilDateFormatter(TemporalType temporalType);  UtilDateFormatter(String pattern); String getPattern(); @Override String format(Date value); static String toPattern(TemporalType temporalType); static final String TIMESTAMP_PATTERN; static final String DAY_PATTERN; static final String HOUR_MIN_PATTERN; }
@Test public void testFormat() { UtilDateFormatter formatter = new UtilDateFormatter(TemporalType.DATE); assertThat(formatter.format(AuditLogDateHelper.of(2016, Month.APRIL, 1)), equalTo("2016-04-01")); }