DateHolder extends AbstractValueHolder { @Override public Date getValue() { return date; } DateHolder(Date date); @Override Date getValue(); @Override Date getDate(); @Override String getString(); String getString(String pattern);  }
@Test public void testGetValue() { assertEquals(d1, h1.getValue()); assertEquals(d2, h2.getValue()); assertNull(h3.getValue()); }
@Test public void testCompareTo() { DateHolder[] array = { new DateHolder(d("07-07-2012")), new DateHolder(null), new DateHolder(d("01-01-2012")), new DateHolder(d("04-04-2012")), new DateHolder(d("03-03-2012")) }; Date[] expectedResult = { null, d("01-01-2012"), d("03-03-2012"), d("04-04-2012"), d("07-07-2012") }; Arrays.sort(array); for (int i = 0; i < array.length; i++) { Date value = array[i].getValue(); Date expected = expectedResult[i]; assertEquals(expected, value); } }