DateType implements Type<DateHolder> { @Override public String encode(DateHolder holder) { return holder.getString(defaultOutputPattern); }  @Override String encode(DateHolder holder); @Override DateHolder decode(String text); @Override DateHolder convert(Object obj); @Override DateHolder[] newArray(int size); static void setDefaultOutputPattern(String pattern); static String getDefaultOutputPattern(); static final String TYPE_NAME; }
@Test public void testEncode() { DateType.setDefaultOutputPattern("dd-MM-yyyy"); Object[][] testCases = { {d("01-01-1900"), "01-01-1900"}, {d("28-02-2000"), "28-02-2000"}, {null, null} }; for (Object[] testCase : testCases) { Date date = (Date) testCase[0]; DateHolder holder = new DateHolder(date); String expectedResult = (String) testCase[1]; assertEquals(expectedResult, type.encode(holder)); } }