UtilDateFormatter implements ValueFormatter<Date> { public String getPattern() { return pattern; } 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 testUtilDateFormatterTemporalType() { assertThat(new UtilDateFormatter(TemporalType.TIMESTAMP).getPattern(), equalTo(UtilDateFormatter.TIMESTAMP_PATTERN)); assertThat(new UtilDateFormatter(TemporalType.DATE).getPattern(), equalTo(UtilDateFormatter.DAY_PATTERN)); assertThat(new UtilDateFormatter(TemporalType.TIME).getPattern(), equalTo(UtilDateFormatter.HOUR_MIN_PATTERN)); assertThat(new UtilDateFormatter((TemporalType) null).getPattern(), equalTo(UtilDateFormatter.TIMESTAMP_PATTERN)); }
@Test public void testUtilDateFormatterString() { String pattern = "YYYY MMM"; assertThat(new UtilDateFormatter(pattern).getPattern(), equalTo(pattern)); }