### Question:
ValueFilterDateRangeLength extends StringFilter { @Override public String filter(String value) { if (value != null) { try { return Long.toString(countDays(value)); } catch (IllegalArgumentException e) { return null; } } return value; } ValueFilterDateRangeLength();  ValueFilterDateRangeLength(String dateFormat, String dateSep, String diffUnit); @Override String filter(String value);  }### Answer:
@Test public void simpleDates() { ValueFilterDateRangeLength vfdrl = new ValueFilterDateRangeLength(); assertEquals("11", vfdrl.filter("090910-090920")); assertEquals("42", vfdrl.filter("090810-090920")); }
@Test public void singleDay() { ValueFilterDateRangeLength vfdrl = new ValueFilterDateRangeLength(); assertEquals("1", vfdrl.filter("090910")); }
@Test public void dayRanges() { ValueFilterDateRangeLength vfdrl = new ValueFilterDateRangeLength(); assertEquals("2", vfdrl.filter("090910,101010")); assertEquals("12", vfdrl.filter("090910,101010-101020")); }
@Test public void nullChecks() { ValueFilterDateRangeLength vfdrl = new ValueFilterDateRangeLength(); assertEquals(null, vfdrl.filter((String) null)); assertEquals(null, vfdrl.filter("090909090909-")); assertEquals(null, vfdrl.filter("090909090909")); assertEquals(null, vfdrl.filter("1090810-090920")); }
@Test public void formatOptions() { ValueFilterDateRangeLength vfdrl = new ValueFilterDateRangeLength("yyyy-MM-dd", "+", "days"); assertEquals("6", vfdrl.filter("2010-10-10+2010-10-15")); }